Skip to content

Commit ed3653c

Browse files
authored
Add gitbook docs (#6)
1 parent 714128f commit ed3653c

12 files changed

+136
-2
lines changed

.gitbook.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root: ./docs/
2+
3+
structure:
4+
readme: README.md
5+
summary: SUMMARY.md

.github/workflows/cron.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check Package
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *' # every day at midnight
5+
- cron: '0 */6 * * *' # Every 6 Hours
66

77
jobs:
88
install:

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# OpenCF
22

33
![Tests](https://github.com/phpjuice/opencf/workflows/Tests/badge.svg?branch=main)
4+
[![Check Package](https://github.com/phpjuice/opencf/actions/workflows/cron.yml/badge.svg)](https://github.com/phpjuice/opencf/actions/workflows/cron.yml)
45
[![Latest Stable Version](http://poser.pugx.org/phpjuice/opencf/v)](https://packagist.org/packages/phpjuice/opencf)
56
[![Total Downloads](http://poser.pugx.org/phpjuice/opencf/downloads)](https://packagist.org/packages/phpjuice/opencf)
67
[![License](http://poser.pugx.org/phpjuice/opencf/license)](https://packagist.org/packages/phpjuice/opencf)
@@ -141,6 +142,7 @@ the [tags on this repository](https://github.com/PHPJuice/opencf/tags).
141142
license. Please see the [Licence](https://github.com/phpjuice/opencf/blob/main/LICENSE) for more information.
142143

143144
![Tests](https://github.com/phpjuice/opencf/workflows/Tests/badge.svg?branch=main)
145+
[![Check Package](https://github.com/phpjuice/opencf/actions/workflows/cron.yml/badge.svg)](https://github.com/phpjuice/opencf/actions/workflows/cron.yml)
144146
[![Latest Stable Version](http://poser.pugx.org/phpjuice/opencf/v)](https://packagist.org/packages/phpjuice/opencf)
145147
[![Total Downloads](http://poser.pugx.org/phpjuice/opencf/downloads)](https://packagist.org/packages/phpjuice/opencf)
146148
[![License](http://poser.pugx.org/phpjuice/opencf/license)](https://packagist.org/packages/phpjuice/opencf)

_config.yml

-1
This file was deleted.

changelog.md

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to `phpjuice/opencf` will be documented in this file.
44

5+
## Version 2.2.0
6+
7+
### Changed
8+
9+
- Add integration tests in #5
10+
11+
## Version 2.1.0
12+
13+
### Changed
14+
15+
- Refactor recommender service in #4
16+
517
## Version 2.0.0
618

719
### Added

docs/README.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# OpenCF
2+
3+
![Tests](https://github.com/phpjuice/opencf/workflows/Tests/badge.svg?branch=main)
4+
[![Check Package](https://github.com/phpjuice/opencf/actions/workflows/cron.yml/badge.svg)](https://github.com/phpjuice/opencf/actions/workflows/cron.yml)
5+
[![Latest Stable Version](http://poser.pugx.org/phpjuice/opencf/v)](https://packagist.org/packages/phpjuice/opencf)
6+
[![Total Downloads](http://poser.pugx.org/phpjuice/opencf/downloads)](https://packagist.org/packages/phpjuice/opencf)
7+
[![License](http://poser.pugx.org/phpjuice/opencf/license)](https://packagist.org/packages/phpjuice/opencf)
8+
9+
PHP implementation of the (Weighted Slopeone,Cosine, Weighted Cosine) rating-based collaborative filtering schemes.
10+
11+
## Usage
12+
13+
OpenCF Package is designed to be very simple and straightforward to use. All you have to do is:
14+
15+
1. Load a training set (dataset)
16+
3. Predict future ratings using a recommender. (Weighted Slopeone,Cosine, Weighted Cosine)
17+
18+
### Create Recommender Service
19+
20+
The `OpenCF` recommender service is created by direct instantiation:
21+
22+
```php
23+
use OpenCF\RecommenderService;
24+
25+
// Training Dataset
26+
$dataset = [
27+
"squid" => [
28+
"user1" => 1,
29+
"user2" => 1,
30+
"user3" => 0.2,
31+
],
32+
"cuttlefish" => [
33+
"user1" => 0.5,
34+
"user3" => 0.4,
35+
"user4" => 0.9,
36+
],
37+
"octopus" => [
38+
"user1" => 0.2,
39+
"user2" => 0.5,
40+
"user3" => 1,
41+
"user4" => 0.4,
42+
],
43+
"nautilus" => [
44+
"user2" => 0.2,
45+
"user3" => 0.4,
46+
"user4" => 0.5,
47+
],
48+
];
49+
50+
// Create a recommender service instance
51+
$recommenderService = new RecommenderService($dataset);
52+
53+
// Retrieve a recommender (Weighted Slopeone)
54+
$recommender = $recommenderService->weightedSlopeone();
55+
56+
// Predict future ratings
57+
$results = $recommender->predict([
58+
"squid" => 0.4
59+
]);
60+
```
61+
62+
This should produce the following results:
63+
64+
```php
65+
[
66+
"cuttlefish" => 0.25,
67+
"octopus" => 0.23,
68+
"nautilus" => 0.1
69+
];
70+
```
71+
72+
![Tests](https://github.com/phpjuice/opencf/workflows/Tests/badge.svg?branch=main)
73+
[![Check Package](https://github.com/phpjuice/opencf/actions/workflows/cron.yml/badge.svg)](https://github.com/phpjuice/opencf/actions/workflows/cron.yml)
74+
[![Latest Stable Version](http://poser.pugx.org/phpjuice/opencf/v)](https://packagist.org/packages/phpjuice/opencf)
75+
[![Total Downloads](http://poser.pugx.org/phpjuice/opencf/downloads)](https://packagist.org/packages/phpjuice/opencf)
76+
[![License](http://poser.pugx.org/phpjuice/opencf/license)](https://packagist.org/packages/phpjuice/opencf)

docs/SUMMARY.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Table of contents
2+
3+
* [Introduction](README.md)
4+
* [Requirements](requirements.md)
5+
* [Installation](installation.md)
6+
* [Upgrading](upgrading.md)
7+
* [Questions and issues](questions-and-issues.md)
8+
* [Changelog](changelog.md)

docs/changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Changelog
2+
3+
All notable changes to `opencf` are documented on [GitHub](../changelog.md)
4+

docs/installation.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Installation
2+
3+
The supported way of installing `phpjuice/opencf` package is via Composer.
4+
5+
```bash
6+
composer require phpjuice/opencf
7+
```

docs/questions-and-issues.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Questions and issues
2+
3+
Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the package? Feel free to [create an issue on GitHub](https://github.com/phpjuice/opencf/issues), we'll try to address it as soon as possible.
4+
5+
If you discover any security related issues, please email us at <[email protected]> instead of using the issue tracker.
6+

docs/requirements.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Requirements
2+
3+
## Requirements
4+
5+
`phpjuice/opencf` Package requires PHP 7.4 or higher. If you are using an older version of php this package will not function correctly.
6+
7+
## Older versions
8+
9+
If you do not meet the requirements, you can opt to use an older version of the package. We only actively maintain the latest version.

docs/upgrading.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Upgrading
2+
3+
## UPGRADING FROM V1 TO V2
4+
5+
There are no special requirements for upgrading from v1 to v2, other than changing ^1.xx \(xx can vary\) to ^2.0 in your
6+
composer. json and running `composer update`. Of course, your app must meet the minimum requirements as well.

0 commit comments

Comments
 (0)