Fixed Google Colab link in week 3 day 4, and latest week 8 updates

This commit is contained in:
Edward Donner
2024-09-27 08:35:09 -04:00
parent 95596c52f8
commit e02dca5058
18 changed files with 74561 additions and 858 deletions

View File

@@ -0,0 +1,29 @@
import pandas as pd
from sklearn.linear_model import LinearRegression
import joblib
from agents.specialist_agent import SpecialistAgent
from agents.frontier_agent import FrontierAgent
from agents.random_forest_agent import RandomForestAgent
class EnsembleAgent:
def __init__(self, collection):
self.specialist = SpecialistAgent()
self.frontier = FrontierAgent(collection)
self.random_forest = RandomForestAgent()
self.model = joblib.load('ensemble_model.pkl')
def price(self, description):
specialist = self.specialist.price(description)
frontier = self.frontier.price(description)
random_forest = self.random_forest.price(description)
X = pd.DataFrame({
'Specialist': [specialist],
'Frontier': [frontier],
'RandomForest': [random_forest],
'Min': [min(specialist, frontier, random_forest)],
'Max': [max(specialist, frontier, random_forest)],
})
y = self.model.predict(X)
return y[0]