Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
GiacomoAru committed Jan 7, 2024
2 parents c44ef64 + 4594238 commit 41238cd
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 240 deletions.
26 changes: 15 additions & 11 deletions TASK_3/indicators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# %% [markdown]
# # Definition and study of the features to use for the classification task

Expand All @@ -15,7 +14,7 @@
import json
sys.path.append(os.path.abspath('..'))
from plot_utils import *
# %matplotlib inline
%matplotlib inline
from classification_utils import *
from enum import Enum
import pyproj
Expand Down Expand Up @@ -848,20 +847,25 @@ def save_freq_feature_values(df, path):
save_freq_feature_values(df=X_train_df[y_train==0][features_db], path='../data/classification_results/non_fatal_db_default_features.csv')

# %%
default_db = X_train_df[features_db].median()
default_db['day_of_week_x'] = 0
default_db['day_of_week_y'] = 0
default_db['day_x'] = 0
default_db['day_y'] = 0
default_db['month_x'] = 0
default_db['month_y'] = 0
default_db.to_frame().T.to_csv('../data/classification_results/db_default_features.csv', index=False)
default_rb = X_train_df[features_rb].median()
default_rb.to_frame().T.to_csv('../data/classification_results/rb_default_features.csv', index=False)

default_db = X_train_df[features_db].median()

default_db['day_x'] = np.sin(2 * np.pi * default_rb['day'] / 31.0)
default_db['day_y'] = np.cos(2 * np.pi * default_rb['day'] / 31.0)

default_db['day_of_week_x'] = np.sin(2 * np.pi * default_rb['day_of_week'] / 31.0)
default_db['day_of_week_y'] = np.cos(2 * np.pi * default_rb['day_of_week'] / 31.0)

default_db['month_x'] = np.sin(2 * np.pi * default_rb['month'] / 31.0)
default_db['month_y'] = np.cos(2 * np.pi * default_rb['month'] / 31.0)

default_db.to_frame().T.to_csv('../data/classification_results/db_default_features.csv', index=False)

# %% [markdown]
# TODO: compilare una volta definiti
#
#
# # Final Indicators semantics
# | Name | Description | Present in the original dataset |
# | :--: | :---------: | :-----------------------------: |
Expand Down
Loading

0 comments on commit 41238cd

Please sign in to comment.