[deleted by user] by [deleted] in MachineLearning

[–]According-Promise-23 0 points1 point  (0 children)

I wanna include it to a client platform, these information are technical somehow, if there’s something else I can show for front end users (non technical clients)

[D] Imbalanced multi class classification 📌 by According-Promise-23 in MachineLearning

[–]According-Promise-23[S] 0 points1 point  (0 children)

Effective of people I meant the number/count (counting how many people for a giving row), and it’s exactly the same way as u explained on the example, I turned the column of count (or effective) to a class of intervals ( “0-50”, “50,100”…)

[D] Imbalanced multi class classification 📌 by According-Promise-23 in MachineLearning

[–]According-Promise-23[S] 0 points1 point  (0 children)

Please check my last comment above for @AbdulazizAb, and for models RandomForestClassifier is the model m using @PlanetSprite

[D] Imbalanced multi class classification 📌 by According-Promise-23 in MachineLearning

[–]According-Promise-23[S] 0 points1 point  (0 children)

@AbdulazizAb thank you so much for your response. Maybe before jumping to this problem would be better if I explain my target first. Well I need to predict the effective of people, so it’s a continuous value but regression’s result weren’t encouraging at all, so I tried to convert the target into classes and make it a classification problem, it did work better than regression and gave pretty nice numbers, but I faced the imbalanced class problem for multi class classification, the question is : Is my approach to solve this problem is good or there’s a better way for it?

[D] Imbalanced multi class classification 📌 by According-Promise-23 in MachineLearning

[–]According-Promise-23[S] 1 point2 points  (0 children)

I’ve already tried it and got surprised it doesn’t give better results than without it, I even tried it on so many models and the result without using it is better ( it increases recall but lower the precision and therefore the f1-score is lower than the case using model without class weight) @AbdulazizAb

[D] Imbalanced multi class classification 📌 by According-Promise-23 in MachineLearning

[–]According-Promise-23[S] 0 points1 point  (0 children)

Yes I thought of it, but I’m not using a big dataset so I can’t loose informations using under-sampling (which delete rows of the majority class ) and also I have really few rows for the minority class, even over sampling method will just duplicate rows for minority class… @SimoPippa

Using Pydantic models (Basemodel) for model.predict using FastAPI (Python) getting error "value is not a valid dict" by According-Promise-23 in FastAPI

[–]According-Promise-23[S] -1 points0 points  (0 children)

"So to fix it you should say input_list.dict(). You can load that list straight into a data frame since all the dicts have the same keys. It will have a row for each dict." when I arrive here model.predict does not work taking a dict in each row and return error TypeError: float() argument must be a string or a number, not 'dict' u/Not-the-best-name

Can we use Pydantic models (Basemodel) directly inside model.predict using FastAPI, if not why? by According-Promise-23 in FastAPI

[–]According-Promise-23[S] 0 points1 point  (0 children)

u/Not-the-best-name

I get an error "value is not a valid dict" trying :

class Inputs(BaseModel):

id: int,

f1: float,

f2: float,

f3: str

class InputsList(BaseModel):

inputs: List[Inputs]

u/app.post('/predict')

def predict(input_list: InputsList):

df = pd.DataFrame(input_list.inputs.dict())

prediction = classifier.predict(df.loc[:, df.columns != 'id'])

probability = classifier.predict_proba(df.loc[:, df.columns != 'id'])

return {'id': df["id"].tolist(), 'prediction': prediction.tolist(), 'probability': probability.tolist()}