コード例 #1
0
ファイル: test_stage.py プロジェクト: macressler/UPSG
 def test_pickle(self):
     # TODO this just makes sure the object can be pickled. It doesn't
     # verify that the unpickled object is correct
     uo = UObject(UObjectPhase.Write)
     np_array = np.array([[0]])
     uo.from_np(np_array)
     self.__pickle('upsg.export.csv.CSVWrite', path_of_data('_out.csv'))
     self.__pickle('upsg.fetch.csv.CSVRead', path_of_data('mixed_csv.csv'))
     self.__pickle('upsg.fetch.np.NumpyRead', np.array([[0]]))
     self.__pickle('upsg.transform.split.SplitTrainTest')
     self.__pickle('upsg.transform.split.SplitY', 0)
     self.__pickle('upsg.transform.rename_cols.RenameCols',
                   {'name': 'rename'})
     self.__pickle(wrap('sklearn.preprocessing.Imputer'), strategy='mean',
                   missing_values='NaN')
     self.__pickle(wrap('sklearn.svm.SVC'), gamma=0.1)
     self.__pickle(wrap('sklearn.metrics.roc_curve'))
コード例 #2
0
ファイル: timify.py プロジェクト: macressler/UPSG
    def run(self, outputs_requested, **kwargs):
        in_data = kwargs['input'].to_np()
        cols = []
        dtype = []
        
        for name, sub_dtype in in_data.dtype.descr:
            col = in_data[name]
            if 'S' in sub_dtype:
                try:
                    col = col.astype('M8')
                    sub_dtype = col.dtype
                except ValueError: # not a time
                    pass
            cols.append(col)
            dtype.append((name, sub_dtype))

        uo_out = UObject(UObjectPhase.Write)
        uo_out.from_np(np.fromiter(it.izip(*cols), dtype=dtype))
        return {'output': uo_out}