This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pip install -r requirements.txt | |
| # En général le fichier contenant les requirements s'appelle requirements.txt. | |
| # Si ce n'est pas le cas, remplacer requirements.txt par le nom du fichier contenant les requirements. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| deactivate | |
| # Il suffit juste d'utiliser cette commande pour désactiver l'environnement virtuel. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pip install --upgrade <NOM DU PACKAGE> | |
| # Par exemple, pour mettre à jour numpy, on fera: pip install --upgrade numpy | |
| # Variante: | |
| pip install -U <NOM DU PACKAGE> | |
| # E.g.: pip install -U numpy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Une fois placé dans le dossier de votre projet, faites: | |
| virtualenv .venv | |
| source .venv/scripts/activate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import plotly.express as px | |
| # Chargeons une dataframe pour l'exemple: | |
| df = px.data.tips() | |
| # Le code pour faire l'histogramme. À noter que "day" est spécifique à l'exemple en question. | |
| fig = px.histogram(df, x="day") | |
| fig.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| identity = torch.eye(n) # avec n la dimension de la matrice identité. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from copy import deepcopy | |
| model_copy = deepcopy(model) # où model est un modèle que vous avez défini au préalable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| text = "Hello World!" | |
| print(f"J'aimerais vous dire deux mots: {text}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tar -xf file_name.tar.gz | |
| # où file_name.tar.gz est le nom de votre fichier. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import plotly.express as px | |
| # Chargeons des données pour l'exemple: | |
| df = px.data.gapminder().query("year==2007") | |
| # On crée et affiche la carte de l'exemple. | |
| fig = px.choropleth(df, locations="iso_alpha", | |
| color="lifeExp", # lifeExp est une colonne de df. Elle représente l'espérance de vie. | |
| # C'est ce qu'on va visualiser sur la carte. | |
| hover_name="country", # On rajoute la colonne pour voir l'information au survol de la carte. |