Pre-Requisites to Understanding this Article
How do I go about storing my model results in a Digital Ocean DBMS? π€·
Step One - Create the Database Table following the format of your Pandas Dataframe πΌ π
CREATE TABLE Anomaly_Table_DO_Example \
(\
data_preparation_technique VARCHAR(255),\
attribute VARCHAR(255),\
time TIMESTAMP,\
some_values FLOAT,\
some_anomaly_scores FLOAT,\
anomaly_classification INTEGER \
)
Step Two - Modify the Default Date/Time to the Date Time Format suitable for your results π
Step Three - Load Data into your DMBS using the /COPY Methodology as opposed to COPY π€
Step Four - Retrieve the loaded entries using SQL Cells to ensure the results have been loaded correctly
SELECT
time,
some_values,
some_anomaly_scores
FROM anomaly_table_do_example
where data_preparation_technique = 'Isolation_Forest'
import numpy as np
anomaly_dataframe['Anomaly_Detection_Boolean'] = np.where(anomaly_dataframe['some_anomaly_scores']<-0.75,1,0)