import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
from tensorflow import keras
import tensorflow as tf
from tensorflow.keras.applications import *
from tensorflow.keras.preprocessing.image import *
from tensorflow.keras.optimizers import *
from tensorflow.keras.models import *
from tensorflow.keras.layers import *
img_dim_ordering = "tf"
from tensorflow.keras import backend as K
#K.set_image_dim_ordering(img_dim_ordering)
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras.applications import Xception
from tensorflow.keras import initializers
from tensorflow.keras import datasets, layers, models
from tensorflow.keras import regularizers
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers.experimental import preprocessing
from PIL import Image
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
from scipy import ndimage
from sklearn.metrics import f1_score
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import PolynomialFeatures
from sklearn.metrics import mean_absolute_error
from sklearn.preprocessing import MinMaxScaler
# อ่านข้อมูล train
data = pd.read_csv('/work/DatasetA.csv')
print('data = ', len(data))
data
data
data.info()
df = data
df['Result'] = 0
df.loc[df[(df.Age >= 40) & (df['Car Segment'] == 'Eco Car') & (df.Occupation != 'Self Employee') & (df.Income >= 60000) & (df.Income <= 200000)].index,'Result'] = 1
count = 0
for i in df.Result:
if i == 1:
count = count + 1
count
df = data
df['Result1'] = 0
df.loc[df[(df.Age >= 29) & (df.Age < 40) & (df['Car Segment'] == 'Eco Car') & (df.Occupation != 'Self Employee') & (df.Income >= 60000) & (df.Income <= 200000) & (df.Flag_Customer_NPL == 0)].index,'Result1'] = 1
count = 0
for i in df.Result1:
if i == 1:
count = count + 1
count
data['Result'] = df.Result+df.Result1
data = data.drop(['Result1'],axis = 1)
data