Skip to content

Commit 6f731b2

Browse files
committed
Added composer installation instructions
1 parent 005e219 commit 6f731b2

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,21 @@ This is a multilayer feed forward neural network for text sentiment classificati
44
- **Difficulty:** Hard
55
- **Training time:** Hours
66

7+
## Installation
8+
Clone the project locally using [Composer](https://getcomposer.org/):
9+
```sh
10+
$ composer create-project rubix/sentiment
11+
```
12+
13+
> **Note:** Installation may take longer than usual because of the large dataset.
14+
715
## Requirements
816
- [PHP](https://php.net) 7.2 or above
917

1018
#### Recommended
1119
- [Tensor extension](https://github.com/RubixML/Tensor) for faster training and inference
1220
- 12G of system memory or more
1321

14-
## Installation
15-
Clone the project locally with [Git](https://git-scm.com/):
16-
```sh
17-
$ git clone https://github.com/RubixML/Sentiment
18-
```
19-
20-
> **Note:** Cloning may take longer than usual because of the large dataset.
21-
22-
Install project dependencies with [Composer](http://getcomposer.org/):
23-
```sh
24-
$ composer install
25-
```
26-
2722
## Tutorial
2823

2924
### Introduction
@@ -142,6 +137,11 @@ Finally, we save the model so we can load it later in our other scripts.
142137
$estimator->save();
143138
```
144139

140+
Now you're ready to run the training script from the command line.
141+
```php
142+
$ php train.php
143+
```
144+
145145
### Cross Validation
146146
To test the generalization performance of the trained network we'll use the testing samples provided to us to generate predictions and then analyze them compared to their ground-truth labels using a cross validation report. Note that we do not use any training data for cross validation because we want to test the model on samples it has never seen before.
147147

@@ -202,6 +202,11 @@ To generate the report, pass in the predictions along with the labels from the t
202202
$results = $report->generate($predictions, $dataset->labels());
203203
```
204204

205+
Execute the validation script from the command line like we see below.
206+
```sh
207+
$ php validate.php
208+
```
209+
205210
Take a look at the report and see how well the model performs. According to the example report below, our model is 87% accurate.
206211

207212
```json
@@ -315,6 +320,11 @@ $prediction = $estimator->predictSample([$text]);
315320
echo "The sentiment is: $prediction" . PHP_EOL;
316321
```
317322

323+
To run the prediction script enter the following on the command line.
324+
```sh
325+
php predict.php
326+
```
327+
318328
**Output**
319329

320330
```sh

composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
"league/csv": "^9.5",
2626
"rubix/ml": "^0.1.0-rc3"
2727
},
28+
"suggest": {
29+
"ext-tensor": "For faster training and inference"
30+
},
31+
"scripts": {
32+
"predict": "@php predict.php",
33+
"train": "@php train.php",
34+
"test": "@php validate.php"
35+
},
2836
"config": {
2937
"preferred-install": "dist",
3038
"sort-packages": true

0 commit comments

Comments
 (0)