Skip to content

Commit 350bba9

Browse files
authored
Merge pull request #1 from anyappinc/renovate-entire-project
Renovate the entire project
2 parents d629f2e + 9966d71 commit 350bba9

14 files changed

+844
-763
lines changed

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

LICENSE

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
The MIT License (MIT)
22

3+
Copyright (c) 2021 株式会社エニーアップ
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+
23+
The original design and implementation are distributed by Sajari Pty Ltd
24+
under the same license, available at https://github.com/sajari/regression
25+
The following is the original copyright.
26+
27+
The MIT License (MIT)
28+
329
Copyright (c) 2014 Sajari Pty Ltd
430

531
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -18,4 +44,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1844
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1945
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2046
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
47+
THE SOFTWARE.

README.md

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
regression
22
=======
3-
[![GoDoc](https://godoc.org/github.com/sajari/regression?status.svg)](https://godoc.org/github.com/sajari/regression)
4-
[![Go Report Card](https://goreportcard.com/badge/sajari/regression)](https://goreportcard.com/report/sajari/regression)
5-
[![Build Status](https://travis-ci.org/sajari/regression.svg?branch=master)](https://travis-ci.org/sajari/regression)
63
[![License][license-image]][license-url]
74

85
[license-image]: http://img.shields.io/badge/license-MIT-green.svg?style=flat-square
9-
[license-url]: LICENSE.txt
6+
[license-url]: LICENSE
107

8+
Goで重回帰分析するライブラリ
119
Multivariable Linear Regression in Go (golang)
1210

11+
*NOTE: This project is originally based on https://github.com/sajari/regression*
12+
1313
installation
1414
------------
1515

16-
$ go get github.com/sajari/regression
17-
18-
Supports Go 1.8+
16+
$ go get github.com/anyappinc/regression
1917

2018
example usage
2119
-------------
@@ -28,68 +26,57 @@ package main
2826
import (
2927
"fmt"
3028

31-
"github.com/sajari/regression"
29+
"github.com/anyappinc/regression"
3230
)
3331

3432
func main() {
35-
r := new(regression.Regression)
36-
r.SetObserved("Murders per annum per 1,000,000 inhabitants")
37-
r.SetVar(0, "Inhabitants")
38-
r.SetVar(1, "Percent with incomes below $5000")
39-
r.SetVar(2, "Percent unemployed")
40-
r.Train(
41-
regression.DataPoint(11.2, []float64{587000, 16.5, 6.2}),
42-
regression.DataPoint(13.4, []float64{643000, 20.5, 6.4}),
43-
regression.DataPoint(40.7, []float64{635000, 26.3, 9.3}),
44-
regression.DataPoint(5.3, []float64{692000, 16.5, 5.3}),
45-
regression.DataPoint(24.8, []float64{1248000, 19.2, 7.3}),
46-
regression.DataPoint(12.7, []float64{643000, 16.5, 5.9}),
47-
regression.DataPoint(20.9, []float64{1964000, 20.2, 6.4}),
48-
regression.DataPoint(35.7, []float64{1531000, 21.3, 7.6}),
49-
regression.DataPoint(8.7, []float64{713000, 17.2, 4.9}),
50-
regression.DataPoint(9.6, []float64{749000, 14.3, 6.4}),
51-
regression.DataPoint(14.5, []float64{7895000, 18.1, 6}),
52-
regression.DataPoint(26.9, []float64{762000, 23.1, 7.4}),
53-
regression.DataPoint(15.7, []float64{2793000, 19.1, 5.8}),
54-
regression.DataPoint(36.2, []float64{741000, 24.7, 8.6}),
55-
regression.DataPoint(18.1, []float64{625000, 18.6, 6.5}),
56-
regression.DataPoint(28.9, []float64{854000, 24.9, 8.3}),
57-
regression.DataPoint(14.9, []float64{716000, 17.9, 6.7}),
58-
regression.DataPoint(25.8, []float64{921000, 22.4, 8.6}),
59-
regression.DataPoint(21.7, []float64{595000, 20.2, 8.4}),
60-
regression.DataPoint(25.7, []float64{3353000, 16.9, 6.7}),
33+
r := regression.NewRegression()
34+
r.SetObjectiveVariableLabel("Murders per annum per 1,000,000 inhabitants")
35+
r.SetExplanatoryVariableLabel(0, "Inhabitants")
36+
r.SetExplanatoryVariableLabel(1, "Percent with incomes below $5000")
37+
r.SetExplanatoryVariableLabel(2, "Percent unemployed")
38+
r.AddObservations(
39+
regression.NewObservation(11.2, []float64{587000, 16.5, 6.2}),
40+
regression.NewObservation(13.4, []float64{643000, 20.5, 6.4}),
41+
regression.NewObservation(40.7, []float64{635000, 26.3, 9.3}),
42+
regression.NewObservation(5.3, []float64{692000, 16.5, 5.3}),
43+
regression.NewObservation(24.8, []float64{1248000, 19.2, 7.3}),
44+
regression.NewObservation(12.7, []float64{643000, 16.5, 5.9}),
45+
regression.NewObservation(20.9, []float64{1964000, 20.2, 6.4}),
46+
regression.NewObservation(35.7, []float64{1531000, 21.3, 7.6}),
47+
regression.NewObservation(8.7, []float64{713000, 17.2, 4.9}),
48+
regression.NewObservation(9.6, []float64{749000, 14.3, 6.4}),
49+
regression.NewObservation(14.5, []float64{7895000, 18.1, 6}),
50+
regression.NewObservation(26.9, []float64{762000, 23.1, 7.4}),
51+
regression.NewObservation(15.7, []float64{2793000, 19.1, 5.8}),
52+
regression.NewObservation(36.2, []float64{741000, 24.7, 8.6}),
53+
regression.NewObservation(18.1, []float64{625000, 18.6, 6.5}),
54+
regression.NewObservation(28.9, []float64{854000, 24.9, 8.3}),
55+
regression.NewObservation(14.9, []float64{716000, 17.9, 6.7}),
56+
regression.NewObservation(25.8, []float64{921000, 22.4, 8.6}),
57+
regression.NewObservation(21.7, []float64{595000, 20.2, 8.4}),
58+
regression.NewObservation(25.7, []float64{3353000, 16.9, 6.7}),
6159
)
62-
r.Run()
60+
model, err := r.Run()
61+
if err != nil {
62+
log.Fatalln(err)
63+
}
6364

64-
fmt.Printf("Regression formula:\n%v\n", r.Formula)
65-
fmt.Printf("Regression:\n%s\n", r)
65+
fmt.Printf("Regression formula:\n%v\n", model.FormulaString())
6666
}
6767
```
6868

69-
Note: You can also add data points one by one.
69+
Note: You can also add observations one by one.
7070

71-
Once calculated you can print the data, look at the R^2, Variance, residuals, etc. You can also access the coefficients directly to use elsewhere, e.g.
71+
Once calculated, you can look at the R^2, Standard Error, ANOVA, Coefficients, etc. e.g.
7272

7373
```go
7474
// Get the coefficient for the "Inhabitants" variable 0:
75-
c := r.Coeff(0)
75+
c := model.ExplanatoryVars[0].Coeff
7676
```
7777

78-
You can also use the model to predict new data points
78+
You can also use the model to predict new observation
7979

8080
```go
81-
prediction, err := r.Predict([]float64{587000, 16.5, 6.2})
82-
```
83-
84-
Feature crosses are supported so your model can capture fixed non-linear relationships
85-
86-
```go
87-
88-
r.Train(
89-
regression.DataPoint(11.2, []float64{587000, 16.5, 6.2}),
90-
)
91-
//Add a new feature which is the first variable (index 0) to the power of 2
92-
r.AddCross(PowCross(0, 2))
93-
r.Run()
94-
81+
prediction, err := model.Predict([]float64{587000, 16.5, 6.2})
9582
```

crosses.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

crosses_test.go

Lines changed: 0 additions & 45 deletions
This file was deleted.

examples/DetroitDataDoc.txt

Lines changed: 0 additions & 66 deletions
This file was deleted.

examples/chevy-mechanics.csv

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)