示例#1
0
if __name__ == '__main__':
    import NetLearning
    import Preprocessing
    import DataCreator
    import torch

train, test = Preprocessing.DataPreparation(Preprocessing.GetData().do(),
                                            test_size=0).train_test_split()
net, scores = NetLearning.Learn(epochs=30, train_loader=train).fit()
best = net.get_best_model()
示例#2
0
import pandas as pd
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import Preprocessing as pp
import feature_selection as sel
import eval
import models
from HyperParamTuning import RF_paramSearch

# Read data
dp = pp.DataPreparation()
dp.find_nan()  ## Check the number of missing values
dp.rm_na("price")  ## Remove columns with missing price values
dp.impute_nans()  ## Impute nan values according to documention
dp.find_nan()  ## Check if impute was succesful

dp.replace_cat_variable([
    "body-style", "make", "engine-type"
])  ## Transform some categorical variables into continous variables
dp.cluster_groups(
)  ## Transform some non-binary variables into binary categorical variables

raw_data = dp.data  ## Save data set after transformation
bin_cols = [
    "fuel-type", "aspiration", "num-of-doors", "engine-location",
    'drive-wheels', 'fuel-system'
]
cat_cols = []
#cyl_col = "num-of-cylinders"

fe = pp.FeatureEncoding(raw_data)