Skip to content

Commit 5feefc1

Browse files
committed
README and LICENSE
* Clarified some points in the README * Added WTFPL as a license for NlpTools
1 parent 7e2a262 commit 5feefc1

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2004 Sam Hocevar <[email protected]>
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

README.markdown

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,28 @@ $model->train($ff,$tset,$optimizer);
180180
```
181181

182182
After we have trained our model, in order to use it for classification
183-
we have to use it with a compatible classifier. In every possible
184-
parameter types and interfaces are explicitly declared in order to
185-
ensure that only compatible types will be used.
186-
187-
Maxent is a linear model so we will use the FeatureBasedLinearClassifier.
188-
We also pass the feature factory to the classifier.
183+
we have to use it with a compatible classifier. Wherever possible
184+
parameter types are explicitly declared in order to ensure that only
185+
compatible types will be used (Which means that if not sure one can
186+
check what type of model does Maxent implement and then use any
187+
classifier that accepts that model as a parameter).
188+
189+
Maxent creates a set of weights for each feature, the linear
190+
combination of the features with those weights decides the class of
191+
the document so we will use the FeatureBasedLinearClassifier. We also
192+
pass the feature factory to the classifier so that it can recreate
193+
which features would fire for a given class.
194+
195+
Let's define some stuff:
196+
197+
* _ff(d,c)_ is the feature factory function and returns a vector with
198+
either 0 or 1 for each feature
199+
* _w_ is our model which is a vector of real numbers and the same size
200+
as the one returned by the _ff(d,c)_ . It is calculated during
201+
training.
202+
203+
So the classification comes down to _argmax<sub>c</sub>(ff(d,c) • w)_
204+
where • denotes the inner product of two vectors.
189205

190206
```php
191207
$cls = new NlpTools\FeatureBasedLinearClassifier($ff,$model);

0 commit comments

Comments
 (0)