예제 #1
0
 def transform(self, x=None):
     if x is None:
         x, y = load_svmlight(self._test_input_path)
         x = self._model.transform(x)
         save_svmlight(x, y, self._test_output_path)
     else:
         transformed_x = self._model.transform(x)
         return transformed_x
예제 #2
0
파일: cv.py 프로젝트: myungchoi/client-py
 def run(self):
     x, y = load_svmlight(self._input_path)
     kf = cross_validation.KFold(len(y), n_folds=self.k)
     for out_path, (__, test_index) in zip(self._output_path, kf):
         portion_x, portion_y = x[test_index, :], y[test_index]
         save_svmlight(portion_x, portion_y, out_path)
예제 #3
0
 def fit_transform(self):
     self._model = MinMaxScaler()
     x, y = load_svmlight(self.input_path)
     x = x.toarray()
     x = self._model.fit_transform(x, y)
     save_svmlight(x, y, self._output_path)
예제 #4
0
 def fit_transform(self):
     self._model = SelectPercentile(f_classif, self._percentile)
     x, y = load_svmlight(self.input_path)
     x = self._model.fit_transform(x, y)
     save_svmlight(x, y, self._output_path)
예제 #5
0
 def fit_transform(self):
     self._model = VarianceThreshold(threshold=self._threshold)
     x, y = load_svmlight(self.input_path)
     x = self._model.fit_transform(x, y)
     save_svmlight(x, y, self._output_path)