Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter typo fix #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
4 changes: 2 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ the jar manually.
```clojure
REPL>(use 'clj-ml.classifiers)

REPL>; Building a classifier using a C4.5 decission tree
REPL>(def classifier (make-classifier :decission-tree :c45))
REPL>; Building a classifier using a C4.5 decision tree
REPL>(def classifier (make-classifier :decision-tree :c45))

REPL>; We set the class attribute for the loaded dataset
REPL>(dataset-set-class ds 4)
Expand Down
18 changes: 9 additions & 9 deletions src/clj_ml/classifiers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(ns #^{:author "Antonio Garrote <[email protected]>"}
clj-ml.classifiers
"This namespace contains several functions for building classifiers using different
classification algorithms: Bayes networks, multilayer perceptron, decission tree or
classification algorithms: Bayes networks, multilayer perceptron, decision tree or
support vector machines are available. Some of these classifiers have incremental
versions so they can be built without having all the dataset instances in memory.

Expand All @@ -17,8 +17,8 @@

(use 'clj-ml.classifiers)

; Building a classifier using a C4.5 decission tree
(def *classifier* (make-classifier :decission-tree :c45))
; Building a classifier using a C4.5 decision tree
(def *classifier* (make-classifier :decision-tree :c45))

; We set the class attribute for the loaded dataset.
; *dataset* is supposed to contain a set of instances.
Expand Down Expand Up @@ -77,7 +77,7 @@
"Creates the right parameters for a classifier"
(fn [kind algorithm map] [kind algorithm]))

(defmethod make-classifier-options [:decission-tree :c45]
(defmethod make-classifier-options [:decision-tree :c45]
([kind algorithm map]
(let [cols-val (check-options {:unpruned "-U"
:reduced-error-pruning "-R"
Expand Down Expand Up @@ -154,11 +154,11 @@
"Creates a new classifier for the given kind algorithm and options.

The first argument identifies the kind of classifier and the second
argument the algorithm to use, e.g. :decission-tree :c45.
argument the algorithm to use, e.g. :decision-tree :c45.

The classifiers currently supported are:

- :decission-tree :c45
- :decision-tree :c45
- :bayes :naive
- :neural-network :mutilayer-perceptron
- :support-vector-machine :smo
Expand All @@ -169,9 +169,9 @@
This is the description of the supported classifiers and the accepted
option parameters for each of them:

* :decission-tree :c45
* :decision-tree :c45

A classifier building a pruned or unpruned C 4.5 decission tree using
A classifier building a pruned or unpruned C 4.5 decision tree using
Weka J 4.8 implementation.

Parameters:
Expand Down Expand Up @@ -271,7 +271,7 @@
"
(fn [kind algorithm & options] [kind algorithm]))

(defmethod make-classifier [:decission-tree :c45]
(defmethod make-classifier [:decision-tree :c45]
([kind algorithm & options]
(make-classifier-m kind algorithm J48 options)))

Expand Down
10 changes: 5 additions & 5 deletions test/clj_ml/classifiers_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


(deftest make-classifiers-options-c45
(let [options (make-classifier-options :decission-tree :c45 {:unpruned true :reduced-error-pruning true :only-binary-splits true :no-raising true
(let [options (make-classifier-options :decision-tree :c45 {:unpruned true :reduced-error-pruning true :only-binary-splits true :no-raising true
:no-cleanup true :laplace-smoothing true :pruning-confidence 0.12 :minimum-instances 10
:pruning-number-folds 5 :random-seed 1})]
(is (= (aget options 0)
Expand Down Expand Up @@ -40,12 +40,12 @@


(deftest make-classifier-c45
(let [c (make-classifier :decission-tree :c45)]
(let [c (make-classifier :decision-tree :c45)]
(is (= (class c)
weka.classifiers.trees.J48))))

(deftest train-classifier-c45
(let [c (make-classifier :decission-tree :c45)
(let [c (make-classifier :decision-tree :c45)
ds (clj-ml.data/make-dataset "test" [:a :b {:c [:m :n]}] [[1 2 :m] [4 5 :m]])]
(clj-ml.data/dataset-set-class ds 2)
(classifier-train c ds)
Expand All @@ -71,7 +71,7 @@


(deftest classifier-evaluate-dataset
(let [c (make-classifier :decission-tree :c45)
(let [c (make-classifier :decision-tree :c45)
ds (clj-ml.data/make-dataset "test" [:a :b {:c [:m :n]}] [[1 2 :m] [4 5 :m]])
tds (clj-ml.data/make-dataset "test" [:a :b {:c [:m :n]}] [[4 1 :n] [4 5 :m]])
foo1(clj-ml.data/dataset-set-class ds 2)
Expand All @@ -87,7 +87,7 @@


(deftest classifier-evaluate-cross-validation
(let [c (make-classifier :decission-tree :c45)
(let [c (make-classifier :decision-tree :c45)
ds (clj-ml.data/make-dataset "test" [:a :b {:c [:m :n]}] [[1 2 :m] [4 5 :m]])
foo1(clj-ml.data/dataset-set-class ds 2)
foo2 (classifier-train c ds)
Expand Down