Skip to content

Commit 57b72f6

Browse files
committed
Merge branch 'hotfix/0.1.1'
2 parents 44c02d5 + 235c1d3 commit 57b72f6

File tree

7 files changed

+44
-40
lines changed

7 files changed

+44
-40
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ install:
2424
- pip install coveralls
2525

2626
script:
27-
- coverage run --source=nwtgck_hello_test setup.py test
27+
- coverage run --source=src setup.py test
28+
29+
- pip3 install --upgrade git+https://github.com/nwtgck/multi-svr-python.git@$TRAVIS_BRANCH
30+
- python examples/example1.py
2831

2932
after_success:
3033
- coveralls

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Support Vector Regression (SVR) for multidimensional labels
1313
## Usage
1414

1515
```python
16+
import multi_svr
17+
from sklearn import metrics
18+
1619
X = [
1720
[0, 0],
1821
[0, 10],
@@ -32,7 +35,7 @@ y = [
3235
]
3336

3437
# Create SVR
35-
regressor = multi_svr.MutilSVR(kernel='linear')
38+
regressor = multi_svr.MultiSVR(kernel='linear')
3639
# Fit
3740
regressor.fit(X, y)
3841
# Predict
@@ -44,6 +47,6 @@ errs = metrics.mean_squared_error(y, pred_y)
4447
## How to test
4548

4649
```bash
47-
cd <this repo
50+
cd <this repo>
4851
python setup.py test
4952
```

examples/example1.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import multi_svr
2+
from sklearn import metrics
3+
4+
X = [
5+
[0, 0],
6+
[0, 10],
7+
[1, 10],
8+
[1, 20],
9+
[1, 30],
10+
[1, 40]
11+
]
12+
13+
y = [
14+
[0, 0],
15+
[0, 10],
16+
[2, 10],
17+
[2, 20],
18+
[2, 30],
19+
[2, 40]
20+
]
21+
22+
# Create SVR
23+
regressor = multi_svr.MultiSVR(kernel='linear')
24+
# Fit
25+
regressor.fit(X, y)
26+
# Predict
27+
pred_y = regressor.predict(X)
28+
# Calc errors
29+
errs = metrics.mean_squared_error(y, pred_y)
30+
31+
print('pred_y:', pred_y)
32+
print('errs:', errs)

src/multi_svr.py renamed to multi_svr/__init__.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from sklearn import svm
44

55

6-
class MutilSVR(sklearn.base.BaseEstimator, sklearn.base.RegressorMixin):
6+
class MultiSVR(sklearn.base.BaseEstimator, sklearn.base.RegressorMixin):
77
def __init__(self, **kwargs):
88
self.__init_kwargs = kwargs
99

@@ -41,36 +41,3 @@ def predict(self, X):
4141

4242
pred = np.column_stack(tuple(preds))
4343
return pred
44-
45-
46-
47-
48-
if __name__ == '__main__':
49-
from sklearn import metrics
50-
X = [
51-
[0, 0],
52-
[0, 10],
53-
[1, 10],
54-
[1, 20],
55-
[1, 30],
56-
[1, 40]
57-
]
58-
59-
y = [
60-
[0, 0],
61-
[0, 10],
62-
[2, 10],
63-
[2, 20],
64-
[2, 30],
65-
[2, 40]
66-
]
67-
68-
regressor = MutilSVR(kernel='linear')
69-
70-
regressor.fit(X, y)
71-
72-
pred_y = regressor.predict(X)
73-
errs = metrics.mean_squared_error(y, pred_y, multioutput='raw_values')
74-
75-
print('pred_y:', pred_y)
76-
print('errs:', errs)

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
from setuptools import setup, find_packages
66
import sys
77

8-
sys.path.append('./src')
98
sys.path.append('./tests')
109

1110
setup(
1211
name='multi_svr',
13-
version='0.1.0',
12+
version='0.1.1',
1413
description='SVR for multidimensional label',
1514
author='Ryo Ota',
1615
author_email='[email protected]',

src/__init__.py

Whitespace-only changes.

tests/multi_svr_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_prediction(self):
2525
]
2626

2727
# Create SVR
28-
regressor = multi_svr.MutilSVR(kernel='linear')
28+
regressor = multi_svr.MultiSVR(kernel='linear')
2929
# Fit
3030
regressor.fit(X, y)
3131
# Predict

0 commit comments

Comments
 (0)