Comments (5)
Hi @darkdark87 I just released a new version with a fix (v0.1.5). Hopefully it works now—let me know if you still have issues.
from kickscore.
Hi @darkdark87 , thanks for the kind words!
I've actually never had to save models before. I just tried using pickle now at the end of this colab notebook:
import pickle
with open("test.pkl", "wb") as f:
pickle.dump(model, f)
with open("test.pkl", "rb") as f:
m2 = pickle.load(f)
m2.plot_scores(
items=["LAL", "CHI", "BOS"],
resolution=10/seconds_in_year,
figsize=(14.0, 3.0),
timestamps=True)
and it seems to work fine. Could you share a minimum working example where it fails?
from kickscore.
I believe the errors lies with the number of teams. If I increase the number of teams by a factor 3 I receive an error when pickling the model.
I created a minimum "working example" in this notebook.
from kickscore.
Thanks, the example was helpful. I think I understand where the problem—there are circular references between Item
and Observation
, and I understand it trips pickle up after a certain point.
Putting this on my TODO list, but it'll probably have to wait for a few weeks.
In the meantime, if all you're interested in doing with the reloaded model is to make predictions, the following should work reasonably well:
import pickle
# Saving.
fitters = {name: val.fitter for name, val in model.item.items()}
with open("test1.pkl", "wb") as f:
pickle.dump(fitters, f)
# Re-loading.
with open("test1.pkl", "rb") as f:
fitters = pickle.load(f)
m2 = ks.BinaryModel()
dummy = ks.kernel.Constant(var=1.0)
for name, fitter in fitters.items():
m2.add_item(name, kernel=dummy)
m2.item[name].fitter = fitter
It only saves the parameters of the model (which are in the items' fitter
property) though, so you won't be able to retrain it, or inspect the observations it was trained on, etc. However, model.probabilites()
, item.predict()
should work fine.
I'll leave the issue open until I fix persistency in a cleaner way.
from kickscore.
Sounds good @lucasmaystre
My use case requires retraining of the persisted model, so I'll wait.
Thank you.
from kickscore.
Related Issues (11)
- Draw HOT 1
- Model never converges when events with multiples winners are observed HOT 3
- Delta updates HOT 1
- timestamp() error on Windows with dates before 1970 HOT 4
- parameter selection HOT 12
- Algorithm consideration HOT 4
- plot_scores function returns 0 for all but first and last value HOT 4
- Produce ranking HOT 2
- GaussianObservation.probability always returns zero HOT 7
- How countdiff
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kickscore.