def index_prediction(): if request.method == 'POST': data = request.form data = data.to_dict() hasil = prediction_data(data) return render_template('result.html',hasil_prediction=hasil) return render_template('prediction.html',data_type=data_type)
def prediction(): if request.method == 'POST': data = request.form data = data.to_dict() data['MonthlyIncome'] = int(data['MonthlyIncome']) data['NumCompaniesWorked'] = int(data['NumCompaniesWorked']) data['Age'] = int(data['Age']) data['DistanceFromHome'] = int(data['DistanceFromHome']) data['TotalWorkingYears'] = int(data['TotalWorkingYears']) data['TrainingTimesLastYear'] = int(data['TrainingTimesLastYear']) data['YearsAtCompany'] = int(data['YearsAtCompany']) data['YearsSinceLastPromotion'] = int(data['YearsSinceLastPromotion']) data['YearsWithCurrManager'] = int(data['YearsWithCurrManager']) data['JobLevel'] = int(data['JobLevel']) data['StockOptionLevel'] = int(data['StockOptionLevel']) data['JobInvolvement'] = int(data['JobInvolvement']) data['EnvironmentSatisfaction'] = int(data['EnvironmentSatisfaction']) data['JobSatisfaction'] = int(data['JobSatisfaction']) data['WorkLifeBalance'] = int(data['WorkLifeBalance']) data['PerformanceRating'] = int(data['PerformanceRating']) data['PercentSalaryHike'] = int(data['PercentSalaryHike']) hasil = prediction_data(data) # hasil_pred = [] # if hasil == 0: # hasil_pred.append('No') # elif hasil == 1: # hasil_pred.append('Yes') return render_template('result.html', hasil_prediction=hasil) return render_template('prediction.html', data_travel=BusinessTravel, data_dept=sorted(Department), data_edu = Education, data_field=sorted(EducationField), data_gender=Gender, data_role=sorted(JobRole), data_marital=MaritalStatus )
def prediction(): if request.method == "POST": data = request.form data = data.to_dict() hasil = prediction_data(data) hasil2 = feature_importances(data) data['square'] = float(data['square']) data['livingRoom'] = int(data['livingRoom']) data['drawingRoom'] = int(data['drawingRoom']) data['kitchen'] = int(data['kitchen']) data['bathRoom'] = int(data['bathRoom']) data['floor'] = int(data['floor']) data['buildingType'] = str(data['buildingType']) data['constructionTime'] = int(data['constructionTime']) data['renovationCondition'] = str(data['renovationCondition']) data['buildingStructure'] = str(data['buildingStructure']) data['ladderRatio'] = float(data['ladderRatio']) data['elevator'] = str(data['elevator']) data['subway'] = str(data['subway']) data['district'] = str(data['district']) return render_template('result.html', hasil_prediction=hasil, feature=hasil2) return render_template('prediction.html', data_distrik=sorted(distrik), data_structure=sorted(bstructure), data_type=sorted(btype), datarenov=sorted(renovCon), data_subway=sorted(subway2), data_elevator=sorted(elevator), data_time=sorted(conTime))
def index_prediction(): if request.method == "POST": data = request.form ## immutablemultidict data = data.to_dict() data['systolic'] = int(data['systolic']) data['bmi'] = float(data['bmi']) data['arm_circumference'] = float(data['arm_circumference']) data['WH_ratio'] = float(data['WH_ratio']) #hasil = data.to_dict() hasil = prediction_data(data) return render_template('result.html', hasil_prediction=hasil) #return render_template('result.html', hasil_prediction=data) return render_template('prediction.html', )
def index_predicition(): item = list_item_identifier() if request.method == 'POST': data = request.form ## immutablemultidict data = data.to_dict() data['Item_Identifier'] = item_sales_avg(data['Item_Identifier']) data['Outlet_Identifier'] = outlet_sales_avg(data['Outlet_Identifier']) data['Item_MRP'] = float(data['Item_MRP']) hasil = prediction_data(data) return render_template('result.html', hasil_prediction=hasil) return render_template('home.html', data_location_type=sorted(outlet_location_type), data_item_fat=sorted(item_fat_content), data_item_type=sorted(item_type), data_outlet_identifier=sorted(outlet_identifier), data_outlet_type=sorted(outlet_type), data_item_identifier=sorted(item))
def prediction(): if request.method == "POST": data = request.form data = data.to_dict() # hasil2 = feature_importances(data) data['tenure'] = float(data['tenure']) data['MonthlyCharges'] = float(data['MonthlyCharges']) data['TotalCharges'] = float(data['TotalCharges']) # gender if data['gender'] == 'Male': tmpgender = 1 else: tmpgender = 0 data['gender'] = tmpgender # seniorCitizen if data['SeniorCitizen'] == 'Yes': tmpSenior = 1 else: tmpSenior = 0 data['SeniorCitizen'] = tmpSenior # Partner if data['Partner'] == 'Yes': tmpPartner = 1 else: tmpPartner = 0 data['Partner'] = tmpPartner #Phone if data['PhoneService'] == 'Yes': tmpPhone = 1 else: tmpPhone = 0 data['PhoneService'] = tmpPhone if data['StreamingTV'] == 'Yes': tmpTV = 1 else: tmpTV = 0 data['StreamingTV'] = tmpTV if data['InternetService'] == 'Yes': tmpInet = 1 else: tmpInet = 0 data['InternetService'] = tmpInet if data['PaperlessBilling'] == 'Yes': tmpBilling = 1 else: tmpBilling = 0 data['PaperlessBilling'] = tmpBilling hasil = prediction_data(data) hasil2 = prediction_proba(data) return render_template('result.html', hasil_prediction=hasil, hasil_proba=hasil2) return render_template('prediction.html', data_gender=gender, data_decision=decision)