Downloads · 30 days
0
Costestimate/AI-Cost-Estimator
AI-Cost-Estimator is a machine learning model from Costestimate. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
import pandas as pd from sklearn.modelselection import traintestsplit from sklearn.ensemble import RandomForestRegressor from sklearn.preprocessing import OneHotEncoder from sklearn.compose import ColumnTransformer fr…
Downloads · 30 days
0
Access
Public
Updated Sep 20, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 55%
From the Hugging Face model README
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.preprocessing import OneHotEncoder from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline
data = pd.DataFrame({ "Project_Type": ["Residential", "Commercial", "Residential", "Road"], "Area_m2": [120, 500, 200, 2000], "Location": ["Urban", "Urban", "Rural", "Rural"], "Material_Quality": ["Medium", "High", "Low", "Low"], "Cost_USD": [40000, 250000, 60000, 300000] })
X = data.drop("Cost_USD", axis=1) y = data["Cost_USD"]
categorical = ["Project_Type", "Location", "Material_Quality"] numeric = ["Area_m2"]
preprocessor = ColumnTransformer([ ("cat", OneHotEncoder(), categorical), ("num", "passthrough", numeric) ])
model = Pipeline([ ("preprocessor", preprocessor), ("regressor", RandomForestRegressor(n_estimators=100, random_state=42)) ])
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) model.fit(X_train, y_train)
print("Predicted cost:", model.predict(X_test))