资源简介

经典机器学习算法的Python源码,包括DecisionTree、DeepLearning、KMeans、kNN、logistic regression、ManifoldLearning、NaiveBayes、PCA、Ridge、SVM等

资源截图

代码片段和文件信息

# -*- coding: utf-8 -*-
“““
Created on Fri Jul 10 22:04:33 2015

@author: wepon
“““

import numpy as np

class DecisionTree:
    “““决策树使用方法:
    
        - 生成实例: clf = DecisionTrees(). 参数mode可选,ID3或C4.5,默认C4.5
        
        - 训练,调用fit方法: clf.fit(Xy).  Xy均为np.ndarray类型
                            
        - 预测,调用predict方法: clf.predict(X). X为np.ndarray类型
                                 
        - 可视化决策树,调用showTree方法 
    
    “““
    def __init__(selfmode=‘C4.5‘):
        self._tree = None
        
        if mode == ‘C4.5‘ or mode == ‘ID3‘:
            self._mode = mode
        else:
            raise Exception(‘mode should be C4.5 or ID3‘)
        
            
    
    def _calcEntropy(selfy):
        “““
        函数功能:计算熵
        参数y:数据集的标签
        “““
        num = y.shape[0]
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......       180  2017-07-28 02:44  MachineLearning\.gitignore

    .......      9244  2017-07-28 02:44  MachineLearning\DecisionTree\id3_c45.py

    .......      1304  2017-07-28 02:44  MachineLearning\DecisionTree\readme.md

    .......      3283  2017-07-28 02:44  MachineLearning\DecisionTree\treePlotter.py

    .......     12645  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\cnn_LeNet\convolutional_mlp.py

    .......     20706  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\cnn_LeNet\convolutional_mlp_commentate.py

    .......      2197  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\dive_into_keras\cnn-svm.py

    .......      2550  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\dive_into_keras\cnn.py

    .......       756  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\dive_into_keras\data.py

    .......      1432  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\dive_into_keras\get_feature_map.py

    .......      3300  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\dive_into_keras\README.md

    .......   1182905  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\FaceRecognition_CNN(olivettifaces)\olivettifaces.gif

    .......     15554  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\FaceRecognition_CNN(olivettifaces)\train_CNN_olivettifaces.py

    .......      7042  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\FaceRecognition_CNN(olivettifaces)\use_CNN_olivettifaces.py

    .......      5233  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\keras_usage\cnn.py

    .......       764  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\keras_usage\data.py

    .......      9005  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\keras_usage\README.md

    .......     14181  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\mlp\mlp.py

    .......     17794  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\mlp\mlp_with_commentate.py

    .......       527  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\readme.md

    .......      9456  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\Softmax_sgd(or logistic_sgd)\logistic_sgd.py

    .......     19117  2017-07-28 02:44  MachineLearning\DeepLearning Tutorials\Softmax_sgd(or logistic_sgd)\logistic_sgd_commentate.py

    .......     60158  2017-07-28 02:44  MachineLearning\KMeans\data.pkl

    .......      7147  2017-07-28 02:44  MachineLearning\KMeans\kmeans.py

     文件       6072  2018-09-06 19:24  MachineLearning\KMeans\kmeans.pyc

    .......      1237  2017-07-28 02:44  MachineLearning\KMeans\Readme.md

     文件       1299  2018-09-07 00:38  MachineLearning\KMeans\test.py

    .......      2289  2017-07-28 02:44  MachineLearning\kNN\use Python and NumPy\kNN.py

    .......       159  2017-07-28 02:44  MachineLearning\kNN\use Python and NumPy\readme.txt

    .......      1056  2017-07-28 02:44  MachineLearning\kNN\use Python and NumPy\testDigits\0_1.txt

............此处省略618个文件信息

评论

共有 条评论