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
| 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
| 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
| # 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
| 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
| 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 -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
| if [[ $(sfc 2>&1 | tr -d '\0') =~ SCANNOW ]]; then echo Administrator; else echo $USERNAME; fi |
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 <NOM DU PACKAGE>==<VERSION SOUHAITÉE> | |
| # Par exemple, si l'on veut installer la version 1.21 de numpy, on fera: pip install numpy==1.21 |
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 show <NOM DU PACKAGE> | |
| # Par exemple, si l'on veut connaître la version de numpy, on fera: pip show numpy |