Update 'train.py'
This commit is contained in:
parent
935027600c
commit
d67aec6747
16
train.py
16
train.py
@ -2,6 +2,22 @@ import pandas as pd
|
||||
import tensorflow as tf
|
||||
from sklearn.preprocessing import StandardScaler, OneHotEncoder
|
||||
|
||||
water = pd.read_csv('waterQuality1.csv')
|
||||
|
||||
water = water[water['is_safe'].apply(lambda x: str(x).isdigit())]
|
||||
water['is_safe'].value_counts()
|
||||
|
||||
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn import preprocessing
|
||||
water_min_max = preprocessing.MinMaxScaler()
|
||||
water_min_max = water_min_max.fit_transform(water)
|
||||
water_min_max = pd.DataFrame(water_min_max, columns=water.columns)
|
||||
waterNorm = water_min_max
|
||||
|
||||
water_train, water_test = train_test_split(waterNorm, train_size=0.8, random_state=1, stratify=waterNorm["is_safe"])
|
||||
water_test, water_dev = train_test_split(water_test, train_size=0.66, random_state=1, stratify=water_test["is_safe"])
|
||||
|
||||
data_train = pd.read_csv('dane/water_train.csv')
|
||||
|
||||
X_train = data_train.drop('is_safe', axis=1)
|
||||
|
Loading…
Reference in New Issue
Block a user