# Algorithms from scratch

The general steps are as follows:

1. Get 3 things: The formula for the algorithm, the cost function, the derivatives to be used for gradient descent.&#x20;
2. Initialize the weights and bias.
3. In the fit function set the loop to update the weights in each iteration as per the cost function optimization algorithm.
4. Create a predict function to predict the values.
5. Create a test dataset to test if your function works properly.
6. Plot the results.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.thedatascienceinterviewproject.com/python/algorithms-from-scratch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
