Skip to content

Commit

Permalink
README...
Browse files Browse the repository at this point in the history
  • Loading branch information
cstjean committed Jun 29, 2016
1 parent 708a412 commit 5f76986
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
@@ -1,7 +1,7 @@
ScikitLearnBase.jl
------------

This package exposes the scikit-learn interface. Libraries that implement this
This package exposes the scikit-learn interface. Packages that implement this
interface can be used in conjunction with [ScikitLearn.jl](https://github.com/cstjean/ScikitLearn.jl) (pipelines, cross-validation, hyperparameter tuning, ...)

This is an intentionally slim package (~100 LOC, no dependencies). That way,
Expand All @@ -13,10 +13,10 @@ Overview

The docs contain [an overview of the API](http://scikitlearnjl.readthedocs.org/en/latest/api/) and a [more thorough specification](docs/API.md).

There are two implementation strategies for an existing library:
There are two implementation strategies for an existing machine learning package:

- *Create a new type that wraps the existing type*. The new type can usually be written entirely on top of the existing codebase (i.e. without modifying it). This gives more implementation freedom, and a more consistent interface amongst the various ScikitLearn.jl models. Here's an [example](https://github.com/cstjean/DecisionTree.jl/blob/2722950c8f0c5e5c62204364308e28d4123383cb/src/scikitlearnAPI.jl) from DecisionTree.jl
- *Adapt the existing type*. This requires less code, and is usually better when the model type already contains the hyperparameters / fitting arguments.
- *Use the existing type*. This requires less code, and is usually better when the model type already contains the hyperparameters / fitting arguments.

Example
-----
Expand Down Expand Up @@ -45,6 +45,7 @@ ScikitLearnBase.@declare_hyperparameters(NaiveBayes, [:bias])
ScikitLearnBase.is_classifier(::NaiveBayes) = true # not required for transformers

function ScikitLearnBase.fit!(model::NaiveBayes, X, y)
# X should be of size (n_sample, n_feature)
.... # modify model.counts here
return model
end
Expand All @@ -54,8 +55,7 @@ function ScikitLearnBase.predict(model::NaiveBayes, X)
end
```

You can try it out with `ScikitLearn.CrossValidation.cross_val_score`. Models
with more complex hyperparameter specifications should implement `clone`,
Models with more complex hyperparameter specifications should implement `clone`,
`get_params` and `set_params!` explicitly instead of using
`@declare_hyperparameters`.

Expand Down

0 comments on commit 5f76986

Please sign in to comment.