Welcome to DFFML!¶
You can use DFFML from the Command Line, Python, or the HTTP API, see the Quickstart to get started right away.
It makes training and using machine learning models as simple as
from dffml import Features, Feature
from dffml.noasync import train, score, predict
from dffml_model_scikit import LinearRegressionModel
from dffml.accuracy import MeanSquaredErrorAccuracy
model = LinearRegressionModel(
features=Features(
Feature("Years", int, 1),
Feature("Expertise", int, 1),
Feature("Trust", float, 1),
),
predict=Feature("Salary", int, 1),
location="tempdir",
)
# Train the model
train(
model,
{"Years": 0, "Expertise": 1, "Trust": 0.1, "Salary": 10},
{"Years": 1, "Expertise": 3, "Trust": 0.2, "Salary": 20},
{"Years": 2, "Expertise": 5, "Trust": 0.3, "Salary": 30},
{"Years": 3, "Expertise": 7, "Trust": 0.4, "Salary": 40},
)
# Assess accuracy
scorer = MeanSquaredErrorAccuracy()
print(
"Accuracy:",
score(
model,
scorer,
Feature("Salary", int, 1),
{"Years": 4, "Expertise": 9, "Trust": 0.5, "Salary": 50},
{"Years": 5, "Expertise": 11, "Trust": 0.6, "Salary": 60},
),
)
# Make prediction
for i, features, prediction in predict(
model,
{"Years": 6, "Expertise": 13, "Trust": 0.7},
{"Years": 7, "Expertise": 15, "Trust": 0.8},
):
features["Salary"] = prediction["Salary"]["value"]
print(features)
Output:
Accuracy: 1.0
{'Years': 6, 'Expertise': 13, 'Trust': 0.7, 'Salary': 70.0}
{'Years': 7, 'Expertise': 15, 'Trust': 0.8, 'Salary': 80.0}
This is the documentation for the latest release, documentation for the main branch can be found here.
- GitHub
- Master Branch Docs
- Publications
- Contact Us
- Contributing
- News
- Changelog
- [Unreleased]
- [0.4.0] - 2021-02-18
- [0.3.7] - 2020-04-14
- [0.3.6] - 2020-04-04
- [0.3.5] - 2020-03-10
- [0.3.4] - 2020-02-28
- [0.3.3] - 2020-02-10
- [0.3.2] - 2020-01-03
- [0.3.1] - 2019-12-12
- [0.3.0] - 2019-10-26
- [0.2.1] - 2019-06-07
- [0.2.0] - 2019-05-23
- [0.1.2] - 2019-03-29
- [0.1.1] - 2019-03-08
- [0.1.0] - 2019-03-07