Source file owl_regression_generic_sig.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# 1 "src/owl/optimise/owl_regression_generic_sig.ml"
(*
 * OWL - OCaml Scientific Computing
 * Copyright (c) 2016-2022 Liang Wang <liang@ocaml.xyz>
 *)

module type Sig = sig
  module Optimise : Owl_optimise_generic_sig.Sig

  open Optimise.Algodiff

  (** {5 Type definition} *)

  type arr = A.arr
  (** Type of ndarray values. *)

  type elt = A.elt
  (** Type of scalar values. *)

  (** {5 Regression models} *)
  val ols : ?i:bool -> arr -> arr -> arr array
  (** 
      [ols ?i x y] performs Ordinary Least Squares (OLS) regression on the data [x] and [y].
      - [i] is an optional parameter indicating whether to include an intercept in the model. The default is [true].
      - [x] is the matrix of input features.
      - [y] is the vector of output values.
      Returns an array of coefficients for the linear model.
  *)
  
  val ridge : ?i:bool -> ?alpha:float -> arr -> arr -> arr array
  (** 
      [ridge ?i ?alpha x y] performs Ridge regression on the data [x] and [y].
      - [i] is an optional parameter indicating whether to include an intercept in the model. The default is [true].
      - [alpha] is the regularization strength parameter. The default value is 1.0.
      - [x] is the matrix of input features.
      - [y] is the vector of output values.
      Returns an array of coefficients for the linear model.
  *)
  
  val lasso : ?i:bool -> ?alpha:float -> arr -> arr -> arr array
  (** 
      [lasso ?i ?alpha x y] performs Lasso regression on the data [x] and [y].
      - [i] is an optional parameter indicating whether to include an intercept in the model. The default is [true].
      - [alpha] is the regularization strength parameter. The default value is 1.0.
      - [x] is the matrix of input features.
      - [y] is the vector of output values.
      Returns an array of coefficients for the linear model.
  *)
  
  val elastic_net : ?i:bool -> ?alpha:float -> ?l1_ratio:float -> arr -> arr -> arr array
  (** 
      [elastic_net ?i ?alpha ?l1_ratio x y] performs Elastic Net regression on the data [x] and [y].
      - [i] is an optional parameter indicating whether to include an intercept in the model. The default is [true].
      - [alpha] is the regularization strength parameter. The default value is 1.0.
      - [l1_ratio] is the ratio between L1 and L2 regularization terms. The default value is 0.5.
      - [x] is the matrix of input features.
      - [y] is the vector of output values.
      Returns an array of coefficients for the linear model.
  *)
  
  val svm : ?i:bool -> ?a:float -> arr -> arr -> arr array
  (** 
      [svm ?i ?a x y] performs Support Vector Machine (SVM) classification on the data [x] and [y].
      - [i] is an optional parameter indicating whether to include an intercept in the model. The default is [true].
      - [a] is an optional parameter for the regularization parameter (commonly denoted as C). The default value is 1.0.
      - [x] is the matrix of input features.
      - [y] is the vector of output values.
      Returns an array of support vectors and coefficients.
  *)
  
  val logistic : ?i:bool -> arr -> arr -> arr array
  (** 
      [logistic ?i x y] performs logistic regression on the data [x] and [y].
      - [i] is an optional parameter indicating whether to include an intercept in the model. The default is [true].
      - [x] is the matrix of input features.
      - [y] is the vector of output values.
      Returns an array of coefficients for the logistic model.
  *)
  
  val exponential : ?i:bool -> arr -> arr -> elt * elt * elt
  (** 
      [exponential ?i x y] fits an exponential model to the data [x] and [y].
      - [i] is an optional parameter indicating whether to include an intercept in the model. The default is [true].
      - [x] is the vector of input values.
      - [y] is the vector of output values.
      Returns a tuple containing the coefficients of the exponential model.
  *)
  
  val poly : arr -> arr -> int -> arr
  (** 
      [poly x y degree] fits a polynomial model of the specified [degree] to the data [x] and [y].
      - [x] is the vector of input values.
      - [y] is the vector of output values.
      - [degree] specifies the degree of the polynomial.
      Returns the coefficients of the polynomial model.
  *)
  
end