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


Python Utils.loadFeatures方法代码示例

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


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

示例1: mergeFiles

# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import loadFeatures [as 别名]
 def mergeFiles(self, trainFeaturesFile, testFeaturesFile):
     (namesObservationsTr, coordinatesTr, train) = Utils.loadFeatures(trainFeaturesFile)
     (namesObservationsTe, coordinatesTe, test) = Utils.loadFeatures(testFeaturesFile)
     namesObservations = np.concatenate((namesObservationsTr,namesObservationsTe))
     coordinates = np.concatenate((coordinatesTr, coordinatesTe))
     dataset = np.concatenate((train, test))
     namesObservations = np.reshape(namesObservations, (namesObservations.shape[0],1))
     return (namesObservations, coordinates, dataset)            
开发者ID:koshkabb,项目名称:MitosisDetection,代码行数:10,代码来源:ExecuteTheWholePipeline.py

示例2: run

# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import loadFeatures [as 别名]
 def run(self):
     print "Preparing the environment"
     self.prepareEnvironment()
     print "Reading in the training data"
     imageCollections = data_io.get_train_df()
     wndchrmWorker = WndchrmWorkerTrain()
     print "Getting features"
     if not self.loadWndchrm: #Last wndchrm set of features
         featureGetter = FeatureGetter()
         fileName = data_io.get_savez_name()
         if not self.load: #Last features calculated from candidates
             (namesObservations, coordinates, train) = Utils.calculateFeatures(fileName, featureGetter, imageCollections)
         else:
             (namesObservations, coordinates, train) = Utils.loadFeatures(fileName)
         print "Getting target vector"
         (indexes, target, obs) = featureGetter.getTargetVector(coordinates, namesObservations, train)
         print "Saving images"
         imageSaver = ImageSaver(coordinates[indexes], namesObservations[indexes],
                                 imageCollections, featureGetter.patchSize, target[indexes])
         imageSaver.saveImages()
         print "Executing wndchrm algorithm and extracting features"
         (train, target) = wndchrmWorker.executeWndchrm()
     else:
         (train, target) = wndchrmWorker.loadWndchrmFeatures()
     print "Training the model"
     model = RandomForestClassifier(n_estimators=500, verbose=2, n_jobs=1, min_samples_split=30, random_state=1, compute_importances=True)
     model.fit(train, target)
     print model.feature_importances_
     print "Saving the classifier"
     data_io.save_model(model)
开发者ID:koshkabb,项目名称:MitosisDetection,代码行数:32,代码来源:Trainer.py

示例3: runWithoutWndchrm

# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import loadFeatures [as 别名]
 def runWithoutWndchrm(self):
     print "Reading in the training data"
     imageCollections = data_io.get_train_df()
     print "Getting features"
     featureGetter = FeatureGetter()
     fileName = data_io.get_savez_name()
     if not self.load: #Last features calculated from candidates
         (namesObservations, coordinates, train) = Utils.calculateFeatures(fileName, featureGetter, imageCollections)
     else:
         (namesObservations, coordinates, train) = Utils.loadFeatures(fileName)
     print "Getting target vector"
     (indexes, target, obs) = featureGetter.getTargetVector(coordinates, namesObservations, train)
     print "Training the model"
     classifier = RandomForestClassifier(n_estimators=500, verbose=2, n_jobs=1, min_samples_split=10, random_state=1, compute_importances=True)
     #classifier = KNeighborsClassifier(n_neighbors=50)
     model = Pipeline([('scaling', MinMaxScaler()), ('classifying', classifier)])
     model.fit(obs[indexes], target[indexes])
     print "Saving the classifier"
     data_io.save_model(model)
开发者ID:koshkabb,项目名称:MitosisDetection,代码行数:21,代码来源:Trainer.py


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