I have depression

This commit is contained in:
2023-03-30 10:53:53 +02:00
parent cab64843da
commit 572c0175bf
4 changed files with 34 additions and 17 deletions

View File

@@ -1,8 +1,9 @@
# Regression/Prediction (Totally gonna do later trust bro)
from sklearn.linear_model import LinearRegression
from sklearn.impute import SimpleImputer
from sklearn import preprocessing
import numpy as np
import pandas as pd
def cure_depression(dataset):
@@ -16,6 +17,7 @@ def cure_depression(dataset):
return dataset
# Fuck you and whateevr you fucking stand for you dumb whore faggot
def regression_expression(dataset, column, missing_value):
lr = LinearRegression()
numeric = dataset.select_dtypes(include=np.number)
@@ -32,9 +34,21 @@ def regression_expression(dataset, column, missing_value):
y = traindf[column]
traindf.drop(column, axis=1, inplace=True)
lr.fit(traindf, y)
testdf.drop(column, axis=1, inplace=True)
pred = lr.predict(testdf)
# can't put this in data set directly because length no match
# join testdf and traindf to form dataset perhaps??
testdf[column] = pred
print(testdf.head(30))
# https://scikit-learn.org/stable/modules/preprocessing.html#preprocessing
# That helps ^
# This boi should work, idk i'm implementing blindly
def scaling_zscore(datashitter, col):
scaler = preprocessing.StandardScaler().fit(datashitter[col])
return scaler.transform(datashitter[col])
def scaling_range(datashitter, col):
nonnull = datashitter[col].isna()
minmax_scaler = preprocessing.MinMaxScaler()
trainer = minmax_scaler.fit_transform(datashitter[nonnull])
return minmax_scaler.transform(datashitter[col])