> For the complete documentation index, see [llms.txt](https://jona-projects.gitbook.io/kiwicalc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jona-projects.gitbook.io/kiwicalc/machine-learning/getting-started.md).

# Getting Started

#### Gradient Descent & Ascent

The gradient descent and ascent methods are numerical methods for finding the minimum and maximum points of a function, respectively.

#### Linear Regression

Linear Regression is a popular method for describing a linear connection between two variables or more. Currently, you can use the `linear_regression()` method for finding a trend-line from points in a 2D axis system. The method accepts a collection of x values and a corresponding list of y values, and returns either a lambda expression in the form `lambda x: a*x+b` or \`a\` and \`b\` directly. Just to clarify, \`a\` and \`b\` represent the coefficients of the known linear equation $$y=ax+b$$

Parameters

* `axes`- A collection of x values
* `y_values`- A collection of y values
* `get_values`- Whether to get the \`a\` and \`b\` values in the linear equation \`y=ax+b\`. Default is `False`, so only the lambda expression of the linear equation is returned.

Here is the signature of the method:

```python
def linear_regression(axes, y_values, get_values:bool=False):                    
```

For example:

```python
ages = (43, 21, 25, 42, 57, 59)
glucose_levels = (99, 65, 79, 75, 87, 81)
print(linear_regression(ages, glucose_levels, get_values=True))     
```

#### Mean Absolute Value

The Mean Absolute Value (*MAV*) is a method for calculating the error between two functions in a given range. The method accepts two functions and range of numbers to check in. and sums the absolute value of difference of the y values for each value. This is the formula for $$n$$ values:&#x20;

$$
\frac{1}{n} \sum\limits\_{i = 1}^n {|\hat{y\_i} - y\_i|}
$$

&#x20;You can use this method via the `mav()` method. Here is the signature of the method:

```python
def mav(func1: Callable, func2: Callable, start: float, stop: float, step: float):
```

#### Mean Square Value

The Mean Square Value (*MSV*) is another function for computing the error between two given functions.The method accepts two functions and range of numbers to check in and sums the difference of the squared y values for each value. This is the formula for  $$n$$ values:&#x20;

$$
\frac{1}{n} \sum\limits\_{i=1}^n (\hat{y\_i} - y\_i)^2
$$

You can use this method via the `msv()` method. Here is the signature of the method:

```python
def msv(func1: Callable, func2: Callable, start: float, stop: float, step: float):
```

#### Mean Root Value

The Mean Root Value (*MRV*) is another error function. Here is the formula:&#x20;

$$
\frac{1}{n} \sum\limits\_{i=1}^n \sqrt{| \hat{y\_i} - y\_i |}
$$

&#x20;You can use this method via the `mrv()` method. Here is the signature of the method:

```python
def mrv(func1: Callable, func2: Callable, start: float, stop: float, step: float):
```
