# Initialize an experiment

## With the platform (UI)

You can create experiments manually in Picsell.ia in the 'Experiments' tab. It's a basic usage that allows you to initialize an experiment instance with a few parameters :

* name&#x20;
* description
* base architecture
* hyperparameters (will be stored in a data asset)
* dataset&#x20;

{% hint style="info" %}
Let's dive into the concept of **base architecture**  and **dataset** !
{% endhint %}

![](/files/-MT5N0cGH0ITZCXltQfr)

### Base architecture

If you click on one of the button, a modal will open and a list of available base architecture will appear.

![](/files/-MT5l6HO2yi6Nzr0nJd5)

And then if you select a base model, you will see it appear like this&#x20;

![](/files/-MT5lI1G432jTlCrdapr)

{% hint style="warning" %}
**What is the point ?**
{% endhint %}

As ML and AI training process is an iterative process, you may or may not want to use previous checkpoints, trained model, config file of a previous version of your experiments.

This is done **automatically** when selecting a **base experiment or model** 😌

### Dataset

![](/files/-MT5lU3CMTShPIQwofn-)

If you are doing a computer vision experiment, you might have some data in your Datalake and have created some Datasets.&#x20;

To attach a dataset to your experiment so you can download the images or annotations in your code, you can select one here (alternatively you can always pull your datasets by using the `Dataset` class of the Python SDK).

You can now observe the experiments you created in the experiment list of your project, it will look like this.

![](/files/-Me-wvQnVdb0J5o83XQs)

## With the Python SDK

### Create a new experiment

Here is the following snippet that allows you to create a new and clean experiment directly from your python interpreter (or jupyter notebook or IDE or whatever you like).

```python
from picsellia.client import Client

api_token = '4a54b5d45e45f4c454b54dee5b54bac4dd4'
project_token = '9a7d45b4c-691d-4c3a-9972-6a22b1dcd6f'

experiment = Client.Experiment(
    api_token=api_token,
    project_token=project_token
    )
exp = experiment.create(name='classification-v4')
```

You should see the following printed :

```python
{
    'id': '0503901d-ebfb-4b0a-b240-233560d4f8c4', 
    'date_created': '2021-02-09T12:55:17.775657Z', 
    'last_update': '2021-02-09T12:55:17.775302Z', 
    'owner': 1, 
    'project': '49ac1b48-13c8-4651-bfd1-89542d8d3681', 
    'name': 'classification-v4', 
    'description': '', 
    'status': 'started', 
    'logging': None, 
    'files': [], 
    'data': []
}
```

{% hint style="info" %}
The `experiment_id` parameter is saved in the `Client.Experiment` instance, you can now call any method without specifying the id of the experiment.
{% endhint %}

If you go to Picsell.ia in the experiment list of your project, your brand new experiment should appear, waiting for you to feed him with your best parameters, performance metrics or trained models !

![](/files/-Me-xpKrF2YlxROKWU5F)

{% hint style="info" %}
Experiment names must be unique within a project, which means that if you try to create an experiment with a name that is already taken (let's say 'classification-v4') it will be automatically created as 'my\_experiment-v5' and so on.
{% endhint %}

### Create with dataset

If you are doing a computer vision experiment, you might have some data in your Datalake and have created some Datasets.&#x20;

To attach a dataset to your experiment so you can download the images or annotations with the `experiment` class you can specify a `dataset` argument in the `create` method :

{% hint style="warning" %}
You must have attached the desired dataset to the project of your experiment first !
{% endhint %}

```python
experiment.create(
    name='classification-v5',
    dataset='test-dataset/first'
    )
```

Then you will be able to download images and annotations by using the corresponding methods, please check the [sdk reference](/picsellia/references-1/python-sdk-reference-1.md) for more details.

### Iterate from a previous experiment

If you are for example training a neural network, you might need to do several trainings and need to change the dataset or the hyperparameters from one to another. Instead of starting from scratch you can **clone your old experiment's assets** such as checkpoint files to iterate over your model.

To do so you can just call the `create` method and specify the name the experiment you want to clone.<br>

```python
from picsellia.client import Client

api_token = '4a54b5d45e45f4c454b54dee5b54bac4dd4'
project_token = '9a7d45b4c-691d-4c3a-9972-6a22b1dcd6f'

experiment = Client.Experiment(
    api_token=api_token,
    project_token=project_token
    )
exp = experiment.create(
    previous='classification-v5',
    name='classification-v6',
    )
```

You can also specify what assets you want to clone from the previous experiment, for example :&#x20;

```python
experiment.create(
    previous='classification-v5',
    name='classification-v6',
    with_file=True
    )
```

will create a new experiment and get all the **file assets** from the previous one, or&#x20;

```python
experiment.create(
    previous='classification-v5',
    name='classification-v6',
    with_data=True
    )
```

will clone every **data assets**, you can also do both by specifying both arguments.

### Clone a model from the HUB or from your organization

As you may know, Picsell.ia has a [public model HUB](broken://pages/-M7BzGjkmYCgwTc2Tj3i) where you can find state-of-the-art trained models but also the public models from all of our user.

If you want to perform transfer learning from one of those model or from a trained model of your organization, you can also initialize an experiment like this :

```python
experiment.create(
    name='my_new_experiment',
    source='picsell/efficientdet-d0',
    )
```

This will create an experiment and clone all the files that has been saved in this model.


---

# 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://picsellia.gitbook.io/picsellia/experiment-tracking/initialize-an-experiment.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.
