Changeset 9776:600ac31393ee in orange for Orange/regression/pls.py
 Timestamp:
 02/06/12 17:39:53 (2 years ago)
 Branch:
 default
 rebase_source:
 aeea356a746ae91cb578766fe56376f160e20257
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Orange/regression/pls.py
r9671 r9776 8 8 .. _`Parital Least Squares Regression`: http://en.wikipedia.org/wiki/Partial_least_squares_regression 9 9 10 Implementation is based on `Scikit learn python implementation`_ 11 12 Example 13  10 `Partial least squares 11 <http://en.wikipedia.org/wiki/Partial_least_squares_regression>`_ 12 regression is a statistical method which can be used to predict 13 multiple response variables simultaniously. Implementation is based on 14 `Scikit learn python implementation 15 <https://github.com/scikitlearn/scikitlearn/blob/master/sklearn/pls.py>`_. 14 16 15 17 The following code shows how to fit a PLS regression model on a multitarget data set. 16 18 17 19 .. literalinclude:: code/plsexample.py 18 19 Output :: 20 21 Input variables: <FloatVariable 'X1', FloatVariable 'X2', FloatVariable 'X3'> 22 Response variables: <FloatVariable 'Y1', FloatVariable 'Y2', FloatVariable 'Y3', FloatVariable 'Y4'> 23 Prediction for the first 2 data instances: 20 :lines: 7,9,13,14 21 22 .. autoclass:: PLSRegressionLearner 23 :members: 24 25 .. autoclass:: PLSRegression 26 :members: 27 28 Utility functions 29  30 31 .. autofunction:: normalize_matrix 32 33 .. autofunction:: nipals_xy 34 35 .. autofunction:: svd_xy 36 37 38 ======== 39 Examples 40 ======== 41 42 To predict values for the first two data instances 43 use the followin code 44 45 .. literalinclude:: code/plsexample.py 46 :lines: 1620 47 48 Output 49 50 :: 24 51 25 52 Actual [<orange.Value 'Y1'='0.490'>, <orange.Value 'Y2'='1.237'>, <orange.Value 'Y3'='1.808'>, <orange.Value 'Y4'='0.422'>] … … 28 55 Actual [<orange.Value 'Y1'='0.167'>, <orange.Value 'Y2'='0.664'>, <orange.Value 'Y3'='1.378'>, <orange.Value 'Y4'='0.589'>] 29 56 Predicted [<orange.Value 'Y1'='0.058'>, <orange.Value 'Y2'='0.706'>, <orange.Value 'Y3'='1.420'>, <orange.Value 'Y4'='0.599'>] 57 58 To see the coefficient of the model (in this case they are stored in a matrix) 59 print the model 60 61 .. literalinclude:: code/plsexample.py 62 :lines: 22 63 64 The ouptut looks like 65 66 :: 30 67 31 68 Regression coefficients: … … 35 72 X3 0.230 0.314 0.880 0.060 36 73 37 38 39 .. autoclass:: PLSRegressionLearner40 :members:41 42 .. autoclass:: PLSRegression43 :members:44 45 Utility functions46 47 48 .. autofunction:: normalize_matrix49 50 .. autofunction:: nipals_xy51 52 .. autofunction:: svd_xy53 54 .. _`Scikit learn python implementation`: https://github.com/scikitlearn/scikitlearn/blob/master/sklearn/pls.py55 74 56 75 """ … … 390 409 .. attribute:: x_vars 391 410 392 list of independentvariables411 Predictor variables 393 412 394 413 .. attribute:: y_vars 395 414 396 list of response variables415 Response variables 397 416 398 417 """
Note: See TracChangeset
for help on using the changeset viewer.