Sonny4Sonnix commited on
Commit
6614e23
·
1 Parent(s): e026fae

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +17 -3
main.py CHANGED
@@ -45,6 +45,10 @@ async def predict(input: InputFeatures):
45
 
46
 
47
  full_pipeline=ColumnTransformer([('num_pipe',num_pipeline,num_attr)])
 
 
 
 
48
 
49
  XGB = Pipeline([
50
  ("col_trans", full_pipeline), # You need to define full_pipeline
@@ -52,9 +56,19 @@ async def predict(input: InputFeatures):
52
  ("model", BaggingClassifier(base_estimator=XGBClassifier(random_state=42)))
53
  ])
54
 
55
- df = pd.DataFrame([input])
56
- final_input = np.array(full_pipeline.fit_transform(df), dtype=np.str) # Check predict_input, maybe it should be XGB
57
- prediction = model_input.predict(np.array([final_input]).reshape(1, -1))
 
 
 
 
 
 
 
 
 
 
58
 
59
  return prediction
60
 
 
45
 
46
 
47
  full_pipeline=ColumnTransformer([('num_pipe',num_pipeline,num_attr)])
48
+ full_pipeline.fit(df) # Fit the full pipeline on the DataFrame
49
+
50
+ final_input = np.array(full_pipeline.transform(df), dtype=np.str)
51
+ prediction = model_input.predict(final_input)
52
 
53
  XGB = Pipeline([
54
  ("col_trans", full_pipeline), # You need to define full_pipeline
 
56
  ("model", BaggingClassifier(base_estimator=XGBClassifier(random_state=42)))
57
  ])
58
 
59
+ # df = pd.DataFrame([input])
60
+ # final_input = np.array(full_pipeline.fit_transform(df), dtype=np.str) # Check predict_input, maybe it should be XGB
61
+ # #prediction = model_input.predict(np.array([final_input]).reshape(1, -1))
62
+ # prediction = model_input.predict(final_input)
63
+
64
+ # full_pipeline = ColumnTransformer([('num_pipe', num_pipeline, num_attr)])
65
+ # full_pipeline.fit(df) # Fit the full pipeline on the DataFrame
66
+
67
+ # #final_input = np.array(full_pipeline.transform(df), dtype=np.str)
68
+
69
+
70
+
71
+
72
 
73
  return prediction
74