MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / get_data

Function get_data

supervised_class2/rf_classification.py:87–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85
86
87def get_data():
88 df = pd.read_csv('../large_files/mushroom.data', header=None)
89
90 # replace label column: e/p --> 0/1
91 # e = edible = 0, p = poisonous = 1
92 df[0] = df.apply(lambda row: 0 if row[0] == 'e' else 1, axis=1)
93
94 # check if there is missing data
95 replace_missing(df)
96
97 # transform the data
98 transformer = DataTransformer()
99
100 X = transformer.fit_transform(df)
101 Y = df[0].values
102 return X, Y
103
104
105if __name__ == '__main__':

Callers 3

rf_vs_bag2.pyFile · 0.90
adaboost.pyFile · 0.90

Calls 3

fit_transformMethod · 0.95
replace_missingFunction · 0.85
DataTransformerClass · 0.70

Tested by

no test coverage detected