Verified Commit da4f726f authored by Markus Shepherd's avatar Markus Shepherd 🙊
Browse files

first draft

parent f7b7595d
Pipeline #376654 passed with stage
in 24 seconds
......@@ -129,4 +129,7 @@ sitepackages/
# others
.~*
*.bk
*.feather
*.ipynb
*.parquet
*.pickle
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[requires]
python_version = "3.8"
[packages]
board-game-recommender = "*"
bokeh = "*"
jupyter = "*"
jupyterlab = "<3.0.0"
jupytext = "*"
matplotlib = "*"
nb-black = "*"
numpy = "*"
pandas = "*"
pytility = "*"
scikit-learn = "*"
scipy = "*"
seaborn = "*"
[dev-packages]
This diff is collapsed.
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.8.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
import numpy as np
import pandas as pd
from board_game_recommender import BGGRecommender
from sklearn.linear_model import ElasticNetCV
SEED = 23
# %matplotlib inline
# %load_ext nb_black
# %load_ext lab_black
# %%
games = pd.read_csv(
"../../../board-game-data/scraped/bgg_GameItem.csv", index_col="bgg_id"
)
games.shape
# %%
games.sample(5, random_state=SEED).T
# %%
recommender = BGGRecommender.load(
"../../../recommend-games-server/data/recommender_bgg"
)
# %%
ratings = recommender.recommend(
"markus shepherd",
exclude_known=False,
exclude_clusters=False,
exclude_compilations=False,
)
ratings
# %%
games = ratings.to_dataframe().join(games, on="bgg_id", how="inner", lsuffix="_rg")
games.shape
# %%
games[:3].T
# %%
model = ElasticNetCV()
# %%
features = [
"min_players",
"max_players",
"min_age",
"min_time",
"max_time",
"cooperative",
"complexity",
]
data = games.dropna(subset=features)
data.shape
# %%
model.fit(data[features], data["score"])
# %%
model.coef_
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment