Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
doug919 committed Feb 13, 2015
2 parents 9033099 + 2abca90 commit 3dc7944
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 14 deletions.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,75 @@ Python modules for analyzing LJ40K emotion data

![feelit flow](https://cloud.githubusercontent.com/assets/1659204/5698196/fd3873e8-9a42-11e4-803e-81c59a12c143.png)

## batch/batchSimpleTrain.py

perform SVM training for LJ40K

1. usage

```
batchSimpleTraining.py [-h] [-k NFOLD] [-o OUTPUT_NAME] [-e EMOTION_IDS]
[-c C] [-g GAMMA] [-s SCORE_DIR] [-v] [-d]
feature_list_file

positional arguments:
feature_list_file This program will fuse the features listed in this
file and feed all of them to the classifier. The file
format is in JSON. See "feautre_list_ex.json" for
example

optional arguments:
-h, --help show this help message and exit
-k NFOLD, --kfold NFOLD
k for kfold cross-validtion. If the value less than 2,
we skip the cross-validation and choose the first
parameter of -c and -g (DEFAULT: 10)
-o OUTPUT_NAME, --output_file_name OUTPUT_NAME
path to the output file in csv format (DEFAULT:
out.csv)
-e EMOTION_IDS, --emotion_ids EMOTION_IDS
a list that contains emotion ids ranged from 0-39
(DEFAULT: 0). This can be a range expression, e.g.,
3-6,7,8,10-15
-c C SVM parameter (DEFAULT: 1). This can be a list
expression, e.g., 0.1,1,10,100
-g GAMMA, --gamma GAMMA
RBF parameter (DEFAULT: 1/dimensions). This can be a
list expression, e.g., 0.1,1,10,100
-s SCORE_DIR, --output_misc_dir SCORE_DIR
output intermediate data of each emotion in the
specified directory (DEFAULT: not output)
-v, --verbose show messages
-d, --debug show debug messages
```

2. notes

* feature_list_file is in JSON format. Here is an example:
```
[
{
"feature": "TFIDF_TSVD",
"training": "adir/bdir/TFIDF_TSVD.train.npz",
"testing": "cdir/ddir/TFIDF_TSVD.test.npz"
},
{
"feature": "keyword",
"training": "adir/bdir/keyword.train.npz",
"testing": "cdir/ddir/keyword.test.npz"
}
]
```
* Use example:

```
python batchSimpleTraining.py -k 10 -e 0-39 -o output.csv -c 1,10,100,1000 -v feature_list_ex.json
python batchSimpleTraining.py -k 10 -e 0-39 -o output.csv -c 10,30,70,100,300,700,1000 -g 0.0001,0.0003,0.001,0.003,0.01,0.1 TFIDF_TSVD300.json

```
## feelit/features.py

1. Load features from files
Expand Down
29 changes: 15 additions & 14 deletions batch/batchSimpleTraining.README
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,22 @@ optional arguments:
-d, --debug show debug messages

notes:
1. feature_list_file should look like this:
[
{
"feature": "TFIDF_TSVD",
"training": "adir/bdir/TFIDF_TSVD.train.npz",
"testing": "cdir/ddir/TFIDF_TSVD.test.npz"
},
{
"feature": "keyword",
"training": "adir/bdir/keyword.train.npz",
"testing": "cdir/ddir/keyword.test.npz"
}
]

2. Use example:
1. feature_list_file is in JSON format. Here is an example:
[
{
"feature": "TFIDF_TSVD",
"training": "adir/bdir/TFIDF_TSVD.train.npz",
"testing": "cdir/ddir/TFIDF_TSVD.test.npz"
},
{
"feature": "keyword",
"training": "adir/bdir/keyword.train.npz",
"testing": "cdir/ddir/keyword.test.npz"
}
]

2. Use example:
python batchSimpleTraining.py -k 10 -e 0-39 -o output.csv -c 1,10,100,1000 -v feature_list_ex.json
python batchSimpleTraining.py -k 10 -e 0-39 -o output.csv -c 10,30,70,100,300,700,1000 -g 0.0001,0.0003,0.001,0.003,0.01,0.1 TFIDF_TSVD300.json
'''

0 comments on commit 3dc7944

Please sign in to comment.