Skip to content

Commit

Permalink
Shortcode rawhtml (#354)
Browse files Browse the repository at this point in the history
* premier rawhtml

* raw

* rawhtml

* topojson

* update

* Update index.qmd

* Automated changes

* Automated changes

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
linogaliana and github-actions[bot] committed Feb 18, 2023
1 parent 7e15843 commit 3248633
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 33 deletions.
4 changes: 2 additions & 2 deletions content/course/manipulation/04a_webscraping_TP/index.qmd
Expand Up @@ -693,13 +693,13 @@ m.fit_bounds([sw, ne])

La carte obtenue doit ressembler à la suivante:

{{< rawhtml >}}
{{{< rawhtml >}}}
```{python}
#| echo : false
# Afficher la carte
m
```
{{< /rawhtml >}}
{{{< /rawhtml >}}}


# Récupérer des informations sur les pokemons
Expand Down
16 changes: 8 additions & 8 deletions content/course/manipulation/04c_API_TP/index.qmd
Expand Up @@ -278,13 +278,13 @@ def interactive_map_dpe(dpe):
m = interactive_map_dpe(dpe)
```

{{< rawhtml >}}
{{{< rawhtml >}}}
```{python}
#| echo : false
# Afficher la carte
m
```
{{< /rawhtml >}}
{{{< /rawhtml >}}}

On remarque un problème dans les données: un logement qui n'a
rien à voir avec les autres. Il faudrait donc idéalement
Expand Down Expand Up @@ -328,13 +328,13 @@ dpe_geo_filter = get_dpe_from_url(url_api)
m_geo_filter = interactive_map_dpe(dpe)
```

{{< rawhtml >}}
{{{< rawhtml >}}}
```{python}
#| echo : false
# Afficher la carte
m_geo_filter
```
{{< /rawhtml >}}
{{{< /rawhtml >}}}

## Un catalogue incomplet d'API existantes

Expand Down Expand Up @@ -520,13 +520,13 @@ m.fit_bounds([sw, ne])
m
```

{{< rawhtml >}}
{{{< rawhtml >}}}
```{python}
#| echo : false
# Afficher la carte
m
```
{{< /rawhtml >}}
{{{< /rawhtml >}}}



Expand Down Expand Up @@ -748,13 +748,13 @@ m.fit_bounds([sw, ne])

Ce qui permet d'obtenir la carte:

{{< rawhtml >}}
{{{< rawhtml >}}}
```{python}
#| echo : false
# Afficher la carte
m
```
{{< /rawhtml >}}
{{{< /rawhtml >}}}

Vous pouvez aller plus loin avec l'exercice suivant.
Celui-ci nécessite une fonction pour créer un cercle autour d'un point (source [ici](https://gis.stackexchange.com/questions/289044/creating-buffer-circle-x-kilometers-from-point-using-python/289923)),
Expand Down
29 changes: 14 additions & 15 deletions content/course/modelisation/6_pipeline/index.qmd
Expand Up @@ -142,15 +142,15 @@ set_config(display='diagram')
pipe
~~~

{{< rawhtml >}}
{{{< rawhtml >}}}

```{python}
#| output: asis
#| echo: false
print(estimator_html_repr(pipe))
```

{{< /rawhtml >}}
{{{< /rawhtml >}}}

Au sein d'une étape de *pipeline*, les paramètres d'un estimateur
sont accessibles avec la notation `<estimator>__<parameter>`.
Expand All @@ -165,15 +165,15 @@ param_grid = {"reduce_dim__n_components":[2, 5, 10], "clf__C":[0.1, 10, 100]}
grid_search = GridSearchCV(pipe, param_grid=param_grid)
```

{{< rawhtml >}}
{{{< rawhtml >}}}

```{python}
#| output: asis
#| echo: false
print(estimator_html_repr(grid_search))
```

{{< /rawhtml >}}
{{{< /rawhtml >}}}


## Données utilisées
Expand Down Expand Up @@ -396,15 +396,15 @@ ce _pipeline_ opère:
pipe
~~~

{{< rawhtml >}}
{{{< rawhtml >}}}

```{python}
#| output: asis
#| echo: false
print(estimator_html_repr(pipe))
```

{{< /rawhtml >}}
{{{< /rawhtml >}}}


Maintenant, il ne reste plus qu'à estimer notre modèle sur l'ensemble
Expand Down Expand Up @@ -615,16 +615,15 @@ end_time = time.time()
print("Elapsed time : {} seconds", int(end_time - start_time))
```

{{< rawhtml >}}
{{{< rawhtml >}}}

```{python}
#| output: asis
#| echo: false
print(estimator_html_repr(grid_search))
```

{{< /rawhtml >}}

{{{< /rawhtml >}}}

```{python}
#| echo: false
Expand All @@ -645,15 +644,15 @@ grid_search.best_estimator_
~~~


{{< rawhtml >}}
{{{< rawhtml >}}}

```{python}
#| output: asis
#| echo: false
print(estimator_html_repr(grid_search.best_estimator_))
```

{{< /rawhtml >}}
{{{< /rawhtml >}}}

Toutes les performances sur les ensembles d'échantillons et de test sur la grille
d'hyperparamètres sont disponibles dans l'attribut:
Expand Down Expand Up @@ -971,15 +970,15 @@ pipe2 = Pipeline([
])
```

{{< rawhtml >}}
{{{< rawhtml >}}}

```{python}
#| output: asis
#| echo: false
print(estimator_html_repr(pipe2))
```

{{< /rawhtml >}}
{{{< /rawhtml >}}}

```{python}
preprocessor = ColumnTransformer(
Expand All @@ -991,15 +990,15 @@ pipe3 = Pipeline(steps=[('preprocessor', preprocessor),
('randomforest', regr)])
```

{{< rawhtml >}}
{{{< rawhtml >}}}

```{python}
#| output: asis
#| echo: false
print(estimator_html_repr(pipe3))
```

{{< /rawhtml >}}
{{{< /rawhtml >}}}

# Références

Expand Down
25 changes: 17 additions & 8 deletions content/course/visualisation/maps/index.qmd
Expand Up @@ -590,14 +590,13 @@ m.fit_bounds([sw, ne])



{{< rawhtml >}}
{{{< rawhtml >}}}
```{python}
#| echo : false
# Afficher la carte
m
```
{{< /rawhtml >}}

{{{< /rawhtml >}}}

::: {.cell .markdown}
```{=html}
Expand Down Expand Up @@ -654,13 +653,13 @@ m.fit_bounds([sw, ne])

La carte obtenue doit ressembler à la suivante:

{{< rawhtml >}}
{{{< rawhtml >}}}
```{python}
#| echo : false
# Afficher la carte
m
```
{{< /rawhtml >}}
{{{< /rawhtml >}}}

# Exercices supplémentaires

Expand All @@ -672,7 +671,14 @@ parisiens et communes dans les autres villes.

Nous allons privilégier une carte à ronds proportionnels (_bubble map_)
aux cartes chorolèpthes qui trompent
l'oeil.
l'oeil. Les instructions d'installation du package `topojson`
sont disponibles dans la partie manipulation

```{python}
#| echo: false
#| output: false
!pip install topojson
```

::: {.cell .markdown}
```{=html}
Expand Down Expand Up @@ -713,8 +719,11 @@ from cartiflette.s3 import download_vectorfile_url_all
# 1/ Fonds communaux
df = download_vectorfile_url_all(
values = ["75", "92", "93", "94"],
level="COMMUNE_ARRONDISSEMENT",
decoupage="departement")
crs=4326,
borders="COMMUNE_ARRONDISSEMENT",
filter_by="DEPARTEMENT",
source="EXPRESS-COG-CARTO-TERRITOIRE",
year=2022)
# 2/ Lambert 93
df = df.to_crs(2154)
# 3/ Départements
Expand Down

0 comments on commit 3248633

Please sign in to comment.