当前位置: 首页>>代码示例>>Python>>正文


Python sklearn.discriminant_analysis方法代码示例

本文整理汇总了Python中sklearn.discriminant_analysis方法的典型用法代码示例。如果您正苦于以下问题:Python sklearn.discriminant_analysis方法的具体用法?Python sklearn.discriminant_analysis怎么用?Python sklearn.discriminant_analysis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sklearn的用法示例。


在下文中一共展示了sklearn.discriminant_analysis方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import sklearn [as 别名]
# 或者: from sklearn import discriminant_analysis [as 别名]
def __init__(self, catalogueconstructor=None, selection=None, **params):

        cc = catalogueconstructor
        
        self.waveforms = cc.get_some_waveforms()
        
        if selection is None:
            #~ waveforms = self.waveforms
            raise NotImplementedError
        else:
            peaks_index, = np.nonzero(selection)
            waveforms = cc.get_some_waveforms(peaks_index=peaks_index)
            labels = cc.all_peaks[peaks_index]['cluster_label']
        
        flatten_waveforms = waveforms.reshape(waveforms.shape[0], -1)
        
        self.lda = sklearn.discriminant_analysis.LinearDiscriminantAnalysis()
        self.lda.fit(flatten_waveforms, labels)
        
        
        #In GlobalPCA all feature represent all channels
        self.channel_to_features = np.ones((cc.nb_channel, self.lda._max_components), dtype='bool') 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:24,代码来源:decomposition.py

示例2: init_classifier_impl

# 需要导入模块: import sklearn [as 别名]
# 或者: from sklearn import discriminant_analysis [as 别名]
def init_classifier_impl(field_code: str, init_script: str):
    if init_script is not None:
        init_script = init_script.strip()

    if not init_script:
        from sklearn import tree as sklearn_tree
        return sklearn_tree.DecisionTreeClassifier()

    from sklearn import tree as sklearn_tree
    from sklearn import neural_network as sklearn_neural_network
    from sklearn import neighbors as sklearn_neighbors
    from sklearn import svm as sklearn_svm
    from sklearn import gaussian_process as sklearn_gaussian_process
    from sklearn.gaussian_process import kernels as sklearn_gaussian_process_kernels
    from sklearn import ensemble as sklearn_ensemble
    from sklearn import naive_bayes as sklearn_naive_bayes
    from sklearn import discriminant_analysis as sklearn_discriminant_analysis
    from sklearn import linear_model as sklearn_linear_model

    eval_locals = {
        'sklearn_linear_model': sklearn_linear_model,
        'sklearn_tree': sklearn_tree,
        'sklearn_neural_network': sklearn_neural_network,
        'sklearn_neighbors': sklearn_neighbors,
        'sklearn_svm': sklearn_svm,
        'sklearn_gaussian_process': sklearn_gaussian_process,
        'sklearn_gaussian_process_kernels': sklearn_gaussian_process_kernels,
        'sklearn_ensemble': sklearn_ensemble,
        'sklearn_naive_bayes': sklearn_naive_bayes,
        'sklearn_discriminant_analysis': sklearn_discriminant_analysis
    }
    return eval_script('classifier init script of field {0}'.format(field_code), init_script, eval_locals) 
开发者ID:LexPredict,项目名称:lexpredict-contraxsuite,代码行数:34,代码来源:field_based_ml_field_detection.py


注:本文中的sklearn.discriminant_analysis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。