Skip to content

Commit 1387429

Browse files
committed
Added composer installation instructions
1 parent d4c918a commit 1387429

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/vendor
22
composer.lock
33
report.json
4+
*.model
45
.vscode
56
.vs

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@
22
Use the [K Nearest Neighbors](https://docs.rubixml.com/en/latest/classifiers/k-nearest-neighbors.html) algorithm to predict who of your friends will stay married or get a divorce based on their answers to a 54 question survey about their partner. Included in this project is a 171 sample human-annotated dataset that we'll use to train the learner.
33

44
- **Difficulty**: Easy
5-
- **Training time**: Seconds
6-
7-
## Requirements
8-
- [PHP](https://php.net) 7.2 or above
5+
- **Training time**: Less than a minute
96

107
## Installation
11-
Clone the repository locally using [Git](https://git-scm.com/):
8+
Clone the project locally using [Composer](https://getcomposer.org/):
129
```sh
13-
$ git clone https://github.com/RubixML/Divorce
10+
$ composer create-project rubix/divorce
1411
```
1512

16-
Install dependencies using [Composer](https://getcomposer.org/):
17-
```sh
18-
$ composer install
19-
```
13+
## Requirements
14+
- [PHP](https://php.net) 7.2 or above
2015

2116
## Tutorial
2217

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@
2121
"php": ">=7.2",
2222
"rubix/ml": "^0.1.0-rc2"
2323
},
24+
"scripts": {
25+
"train": "@php train.php"
26+
},
2427
"config": {
2528
"preferred-install": "dist",
2629
"sort-packages": true
27-
}
30+
},
31+
"minimum-stability": "dev",
32+
"prefer-stable": true
2833
}

train.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121

2222
echo 'Making predictions ...' . PHP_EOL;
2323

24-
$predictions = $estimator->predict($testing);
24+
$predictions = $estimator->predict($testing->randomize());
25+
26+
echo 'Example predictions:' . PHP_EOL;
27+
28+
print_r(array_slice($predictions, 0, 3));
2529

2630
$metric = new Accuracy();
2731

0 commit comments

Comments
 (0)