# 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 %}

![](https://2100239547-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M78aoA9Gcxf25O1fNjm%2F-MT53eRCWJMvs1SpcQYN%2F-MT5N0cGH0ITZCXltQfr%2Fimage.png?alt=media\&token=762cb45a-accd-4f28-8f98-a11e66036af1)

### Base architecture

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

![](https://2100239547-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M78aoA9Gcxf25O1fNjm%2F-MT5kyE3aIj4wNZQNL2D%2F-MT5l6HO2yi6Nzr0nJd5%2Fimage.png?alt=media\&token=da979ea4-b65e-4812-a3d7-312d15258b6b)

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

![](https://2100239547-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M78aoA9Gcxf25O1fNjm%2F-MT5kyE3aIj4wNZQNL2D%2F-MT5lI1G432jTlCrdapr%2Fimage.png?alt=media\&token=f4a776ed-14cd-4c68-8e68-92d88be60f16)

{% 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

![](https://2100239547-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M78aoA9Gcxf25O1fNjm%2F-MT5kyE3aIj4wNZQNL2D%2F-MT5lU3CMTShPIQwofn-%2Fimage.png?alt=media\&token=c0f85b55-bcc2-4f38-8d91-7eed0e89a084)

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.

![](https://2100239547-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M78aoA9Gcxf25O1fNjm%2F-Me-weSUmKoherZHNtEw%2F-Me-wvQnVdb0J5o83XQs%2Fimage.png?alt=media\&token=d8f4570e-6fd4-4679-ae36-2f83fa0c0ad5)

## 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 !

![](https://2100239547-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M78aoA9Gcxf25O1fNjm%2F-Me-weSUmKoherZHNtEw%2F-Me-xpKrF2YlxROKWU5F%2Fimage.png?alt=media\&token=83ca6ef6-9392-4e1c-8865-dd78dfad405c)

{% 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](../references-1/python-sdk-reference-1) 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.\


```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-reference) 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.

