Extract definition of function.
parent
27b90421bf
commit
d678be0641
|
@ -27,4 +27,4 @@ dependencies:
|
||||||
- xgboost
|
- xgboost
|
||||||
- pip:
|
- pip:
|
||||||
- biosppy
|
- biosppy
|
||||||
- cr_features
|
- cr_features>=0.2
|
||||||
|
|
|
@ -150,13 +150,15 @@ def straw_cleaning(sensor_data_files, provider):
|
||||||
|
|
||||||
return features
|
return features
|
||||||
|
|
||||||
def impute(df, method='zero'):
|
|
||||||
|
|
||||||
def k_nearest(df):
|
def k_nearest(df):
|
||||||
pd.set_option('display.max_columns', None)
|
pd.set_option('display.max_columns', None)
|
||||||
imputer = KNNImputer(n_neighbors=3)
|
imputer = KNNImputer(n_neighbors=3)
|
||||||
return pd.DataFrame(imputer.fit_transform(df), columns=df.columns)
|
return pd.DataFrame(imputer.fit_transform(df), columns=df.columns)
|
||||||
|
|
||||||
|
|
||||||
|
def impute(df, method='zero'):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'zero': df.fillna(0),
|
'zero': df.fillna(0),
|
||||||
'high_number': df.fillna(1500),
|
'high_number': df.fillna(1500),
|
||||||
|
@ -165,6 +167,7 @@ def impute(df, method='zero'):
|
||||||
'knn': k_nearest(df)
|
'knn': k_nearest(df)
|
||||||
}[method]
|
}[method]
|
||||||
|
|
||||||
|
|
||||||
def graph_bf_af(features, phase_name, plt_flag=False):
|
def graph_bf_af(features, phase_name, plt_flag=False):
|
||||||
if plt_flag:
|
if plt_flag:
|
||||||
sns.set(rc={"figure.figsize":(16, 8)})
|
sns.set(rc={"figure.figsize":(16, 8)})
|
||||||
|
|
|
@ -245,12 +245,14 @@ def straw_cleaning(sensor_data_files, provider, target):
|
||||||
|
|
||||||
return features
|
return features
|
||||||
|
|
||||||
def impute(df, method='zero'):
|
|
||||||
|
|
||||||
def k_nearest(df):
|
def k_nearest(df):
|
||||||
imputer = KNNImputer(n_neighbors=3)
|
imputer = KNNImputer(n_neighbors=3)
|
||||||
return pd.DataFrame(imputer.fit_transform(df), columns=df.columns)
|
return pd.DataFrame(imputer.fit_transform(df), columns=df.columns)
|
||||||
|
|
||||||
|
|
||||||
|
def impute(df, method='zero'):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'zero': df.fillna(0),
|
'zero': df.fillna(0),
|
||||||
'high_number': df.fillna(1500),
|
'high_number': df.fillna(1500),
|
||||||
|
@ -259,6 +261,7 @@ def impute(df, method='zero'):
|
||||||
'knn': k_nearest(df)
|
'knn': k_nearest(df)
|
||||||
}[method]
|
}[method]
|
||||||
|
|
||||||
|
|
||||||
def graph_bf_af(features, phase_name, plt_flag=False):
|
def graph_bf_af(features, phase_name, plt_flag=False):
|
||||||
if plt_flag:
|
if plt_flag:
|
||||||
sns.set(rc={"figure.figsize":(16, 8)})
|
sns.set(rc={"figure.figsize":(16, 8)})
|
||||||
|
|
Loading…
Reference in New Issue