ium_07 sacred
This commit is contained in:
parent
b88ddb3066
commit
113d505f58
@ -15,9 +15,12 @@ ex = Experiment('464953')
|
||||
ex.observers.append(MongoObserver(url='mongodb://admin:IUM_2021@tzietkiewicz.vm.wmi.amu.edu.pl:27017'))
|
||||
ex.observers.append(FileStorageObserver('my_experiment_logs'))
|
||||
|
||||
def datasets_preparation():
|
||||
df_1 = pd.read_csv("datasets/spotify_songs.csv")
|
||||
df_2 = pd.read_csv("datasets/Spotify_Dataset.csv", sep=";")
|
||||
@ex.capture
|
||||
def datasets_preparation(_run):
|
||||
with _run.open_resource("datasets/spotify_songs.csv") as f:
|
||||
df_1 = pd.read_csv(f)
|
||||
with _run.open_resource("datasets/Spotify_Dataset.csv") as f:
|
||||
df_2 = pd.read_csv(f, sep=";")
|
||||
df_1 = df_1.dropna()
|
||||
df_2 = df_2.dropna()
|
||||
df_2 = df_2.rename(columns={'Title': 'track_name'})
|
||||
@ -63,12 +66,6 @@ def run_experiment(test_size, random_state, model_filename):
|
||||
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=test_size, random_state=random_state)
|
||||
Y_train = np.ravel(Y_train)
|
||||
Y_test = np.ravel(Y_test)
|
||||
|
||||
ex.add_resource(X_train)
|
||||
ex.add_resource(X_test)
|
||||
ex.add_resource(Y_train)
|
||||
ex.add_resource(Y_test)
|
||||
|
||||
scaler = StandardScaler()
|
||||
numeric_columns = X_train.select_dtypes(include=['int', 'float']).columns
|
||||
X_train_scaled = scaler.fit_transform(X_train[numeric_columns])
|
||||
|
@ -17,19 +17,17 @@ def config():
|
||||
test_dataset_filename = 'datasets/docker_test_dataset.csv'
|
||||
|
||||
@ex.main
|
||||
def run_evaluation(model_filename, test_dataset_filename):
|
||||
def run_evaluation(_run ,model_filename, test_dataset_filename):
|
||||
with open(model_filename, 'rb') as file:
|
||||
model = pickle.load(file)
|
||||
print("Model został wczytany z pliku:", model_filename)
|
||||
test_df = pd.read_csv(test_dataset_filename)
|
||||
|
||||
with _run.open_resource(test_dataset_filename) as f:
|
||||
test_df = pd.read_csv(f)
|
||||
Y_test = test_df[['playlist_genre']]
|
||||
X_test = test_df.drop(columns='playlist_genre')
|
||||
Y_test = np.ravel(Y_test)
|
||||
scaler = StandardScaler()
|
||||
|
||||
ex.add_resource(X_test)
|
||||
ex.add_resource(Y_test)
|
||||
|
||||
numeric_columns = X_test.select_dtypes(include=['int', 'float']).columns
|
||||
X_test_scaled = scaler.fit_transform(X_test[numeric_columns])
|
||||
Y_pred = model.predict(X_test_scaled)
|
||||
|
Loading…
Reference in New Issue
Block a user