用于scikit学习的遗传特征选择模块

sklearn-genetic的Python项目详细描述


sklearn genetic

用于SCIKIT学习的遗传特征选择模块

遗传算法模拟自然选择的过程来寻找函数的最优值。

安装

pip install sklearn-genetic

要求

  • python=2.7
  • SCIKIT学习>;=0.18
  • DEAP=1.0.2

示例

from__future__importprint_functionimportnumpyasnpfromsklearnimportdatasets,linear_modelfromgenetic_selectionimportGeneticSelectionCVdefmain():iris=datasets.load_iris()# Some noisy data not correlatedE=np.random.uniform(0,0.1,size=(len(iris.data),20))X=np.hstack((iris.data,E))y=iris.targetestimator=linear_model.LogisticRegression(solver="liblinear",multi_class="ovr")selector=GeneticSelectionCV(estimator,cv=5,verbose=1,scoring="accuracy",max_features=5,n_population=50,crossover_proba=0.5,mutation_proba=0.2,n_generations=40,crossover_independent_proba=0.5,mutation_independent_proba=0.05,tournament_size=3,n_gen_no_change=10,caching=True,n_jobs=-1)selector=selector.fit(X,y)print(selector.support_)if__name__=="__main__":main()

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何将java ArrayList对象转换为实际值   web服务如何在JAVA类uisng JAXBElement中解组SOAP UI值   包含无值参数的java HttpClient表单URL   运行简单Camel Restlet演示项目的java问题?   带有自定义图标的java简单SWT警报消息?   java Netbeans 6.8:LibImport可以工作,但编译时“包不存在”   java如何获得绘画完成的通知?   java Hazelcast客户端模式群集故障后如何恢复?   Neo4J中Shapefile的java批插入   为什么ThreadPoolExecutor在Eclipse和从命令行运行Java程序时表现不同?   java在Android中计算两个坐标之间的距离时得到了荒谬的值   java在CardLayout中显示卡本身的下一张卡