{"id":469,"date":"2024-05-12T16:57:00","date_gmt":"2024-05-12T15:57:00","guid":{"rendered":"https:\/\/noiseonthenet.space\/noise\/?p=469"},"modified":"2024-05-12T22:46:02","modified_gmt":"2024-05-12T21:46:02","slug":"sowing-a-decision-tree","status":"publish","type":"post","link":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/","title":{"rendered":"Sowing a (Decision) Tree"},"content":{"rendered":"<div id=\"org0b1f22c\" class=\"figure\"> <p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?ssl=1\" alt=\"ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg\" \/> <\/p> <\/div>\n\n<p> Photo by <a href=\"https:\/\/unsplash.com\/@ramona623?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\">Ramona Edwards<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/a-close-up-of-a-flower-on-a-tree-branch-uKyj-X5qLtU?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\">Unsplash<\/a> <\/p>\n\n<p> In this post I start to build a decision tree in Rust. The complete description will span across several eventual posts. <\/p>\n\n<p> Decision trees are used for classification or regression and may accept categorical or continuous features: in this example I will start a classification decision tree which accepts continuous variables. <\/p>\n\n<p> The algorithm will be greedy i.e. I will build one level at a time by choosing the most effective split across all features. <\/p>\n\n<p> In order to simplify the evaluation of this code against existing implementation (e.g. scikit-learn) I will use a well known dataset: the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Iris_flower_data_set\">Iris dataset<\/a>. <\/p>\n\n<p> The code for this post is avaliable <a href=\"https:\/\/github.com\/noiseOnTheNet\/post010_binary_decision_tree\">here<\/a> <\/p>\n<div id=\"outline-container-orgf7fd880\" class=\"outline-2\">\n<h2 id=\"orgf7fd880\">Loading data and choosing the environment<\/h2>\n<div class=\"outline-text-2\" id=\"text-orgf7fd880\">\n<p> For this experiment I chose the <a href=\"https:\/\/pola.rs\/\">Polars crate<\/a> to manage data loading and manipulation. While there are different ways to read data from a file, the main reasons that led me to this decision are the following: <\/p>\n\n<ul class=\"org-ul\">\n<li>In this algorithm I need to access the dataset features in a simple way, choosing from a list of column names;<\/li>\n<li>I need to filter the dataset iteratively; moreover I&rsquo;d like to avoid duplicating data if possible within this process. Polars provide a nice way to share dataframes and can be filtered using reified filters in the Lazy API.<\/li>\n<\/ul>\n\n<p> There are however some cons in choosing this excellent crate: <\/p>\n\n<ul class=\"org-ul\">\n<li>Series hide the type of the data inside, so there are multiple places where I have to manage possible errors while I know the data type in advance: I decided to bubble up all errors until the main function<\/li>\n<li>it is very big crate respect to the small example I&rsquo;m trying to build: in this case I use a small fraction of the functionalities<\/li>\n<li>Polars are designed to have exceptional performance with large dataset<\/li>\n<\/ul>\n\n<p> For a quick experiment pros win cons, but I may consider a smaller solution in specific future projects. <\/p>\n<\/div>\n<\/div>\n<div id=\"outline-container-org2ef2bc0\" class=\"outline-2\">\n<h2 id=\"org2ef2bc0\">Evaluation of the most effective split<\/h2>\n<div class=\"outline-text-2\" id=\"text-org2ef2bc0\">\n<p> <a href=\"https:\/\/en.wikipedia.org\/wiki\/Decision_tree_learning\">Literature<\/a> suggest two possible metrics to evaluate the best split: Gini&rsquo;s impurity index or Shannon&rsquo;s information etropy gain. <\/p>\n\n<p> Let&rsquo;s start with Gini impurity index: this is equivalent to the probability of misclassification of a sample, i.e. the probability that extracted a sample which belongs to a given category it is randomly assigned to any other available category. <\/p>\n\n<p style=\"text-align:center\"> <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=G+%3D+%5Csum_%7Bc+%5Cin+C%7DP%28x%7Cc%29%5Csum_%7Bk+%5Cneq+c%7DP%28x%7Ck%29+&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"G = &#92;sum_{c &#92;in C}P(x|c)&#92;sum_{k &#92;neq c}P(x|k) \" class=\"latex\" \/> <\/p> \n\n<p> as <\/p>\n\n<p style=\"text-align:center\"> <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=1+-+P%28x%7Cc%29+%3D+%5Csum_%7Bk+%5Cneq+c%7DP%28x%7Ck%29+&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"1 - P(x|c) = &#92;sum_{k &#92;neq c}P(x|k) \" class=\"latex\" \/> <\/p> \n\n<p> we have <\/p>\n\n<p style=\"text-align:center\"> <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=G+%3D+1+-+%5Csum_%7Bc+%5Cin+C%7DP%28x%7Cc%29%5E2+&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"G = 1 - &#92;sum_{c &#92;in C}P(x|c)^2 \" class=\"latex\" \/> <\/p> \n\n<div class=\"org-src-container\">\n<label class=\"org-src-name\"><em><\/em><\/label>\n<pre class=\"src src-rust\" id=\"nil\"><span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">Gini impurity metric<\/span>\n<span style=\"color: #51afef;\">fn<\/span> <span style=\"color: #c678dd;\">estimate_gini<\/span><span style=\"color: #51afef;\">(<\/span><span style=\"color: #dcaeea;\">data<\/span>: &amp; <span style=\"color: #ECBE7B;\">DataFrame<\/span>, <span style=\"color: #dcaeea;\">target<\/span>: &amp; <span style=\"color: #ECBE7B;\">str<\/span><span style=\"color: #51afef;\">)<\/span> -&gt; <span style=\"color: #ECBE7B;\">PolarsResult<\/span><span style=\"color: #51afef;\">&lt;<\/span><span style=\"color: #ECBE7B;\">f64<\/span><span style=\"color: #51afef;\">&gt;<\/span> <span style=\"color: #51afef;\">{<\/span>\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">label_count<\/span>: <span style=\"color: #ECBE7B;\">DataFrame<\/span> = data\n        .column<span style=\"color: #c678dd;\">(<\/span>target<span style=\"color: #c678dd;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>\n        .categorical<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>\n        .value_counts<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">expr<\/span>: <span style=\"color: #ECBE7B;\">Expr<\/span> = <span style=\"color: #c678dd;\">(<\/span>col<span style=\"color: #98be65;\">(<\/span><span style=\"color: #98be65;\">\"counts\"<\/span><span style=\"color: #98be65;\">)<\/span>\n        .cast<span style=\"color: #98be65;\">(<\/span><span style=\"color: #ECBE7B;\">DataType<\/span>::<span style=\"color: #ECBE7B;\">Float64<\/span><span style=\"color: #98be65;\">)<\/span>\n        \/ col<span style=\"color: #98be65;\">(<\/span><span style=\"color: #98be65;\">\"counts\"<\/span><span style=\"color: #98be65;\">)<\/span>.sum<span style=\"color: #98be65;\">()<\/span><span style=\"color: #c678dd;\">)<\/span>\n        .pow<span style=\"color: #c678dd;\">(<\/span><span style=\"color: #da8548; font-weight: bold;\">2<\/span><span style=\"color: #c678dd;\">)<\/span>\n        .alias<span style=\"color: #c678dd;\">(<\/span><span style=\"color: #98be65;\">\"squares\"<\/span><span style=\"color: #c678dd;\">)<\/span>;\n\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">squared<\/span>: <span style=\"color: #ECBE7B;\">DataFrame<\/span> = label_count\n        .lazy<span style=\"color: #c678dd;\">()<\/span>\n        .select<span style=\"color: #c678dd;\">(<\/span><span style=\"color: #98be65;\">[<\/span>expr<span style=\"color: #98be65;\">]<\/span><span style=\"color: #c678dd;\">)<\/span>\n        .collect<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">square_sum<\/span>: <span style=\"color: #ECBE7B;\">f64<\/span> = squared\n        .column<span style=\"color: #c678dd;\">(<\/span><span style=\"color: #98be65;\">\"squares\"<\/span><span style=\"color: #c678dd;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>\n        .sum<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n\n    <span style=\"color: #ECBE7B;\">Ok<\/span><span style=\"color: #c678dd;\">(<\/span><span style=\"color: #da8548; font-weight: bold;\">1.0<\/span> - square_sum<span style=\"color: #c678dd;\">)<\/span>\n<span style=\"color: #51afef;\">}<\/span>\n<\/pre>\n<\/div>\n\n<p> As a first implementation I will calculate this metric splitting the dataset in all possible ways along a given feature. I expect to optimize this step in the future. Moreover in this post I assume the feature has no missing values: I will address this in future posts as well. <\/p>\n\n<div class=\"org-src-container\">\n<label class=\"org-src-name\"><em><\/em><\/label>\n<pre class=\"src src-rust\" id=\"nil\"><span style=\"color: #51afef;\">fn<\/span> <span style=\"color: #c678dd;\">evaluate_metric<\/span><span style=\"color: #51afef;\">(<\/span><span style=\"color: #dcaeea;\">data<\/span>: &amp; <span style=\"color: #ECBE7B;\">DataFrame<\/span>, <span style=\"color: #dcaeea;\">feature<\/span>: &amp; <span style=\"color: #ECBE7B;\">str<\/span>, <span style=\"color: #dcaeea;\">target<\/span>: &amp; <span style=\"color: #ECBE7B;\">str<\/span><span style=\"color: #51afef;\">)<\/span> -&gt; <span style=\"color: #ECBE7B;\">PolarsResult<\/span><span style=\"color: #51afef;\">&lt;<\/span><span style=\"color: #ECBE7B;\">DataFrame<\/span><span style=\"color: #51afef;\">&gt;<\/span> <span style=\"color: #51afef;\">{<\/span>\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">grabs the unique values<\/span>\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">values<\/span> = data.column<span style=\"color: #c678dd;\">(<\/span>feature<span style=\"color: #c678dd;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">unique<\/span> = values.unique<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">create a lagged column to identify split points<\/span>\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">split<\/span> = <span style=\"color: #51afef; font-weight: bold;\">df!<\/span><span style=\"color: #c678dd;\">(<\/span>feature =&gt; unique<span style=\"color: #c678dd;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>\n        .lazy<span style=\"color: #c678dd;\">()<\/span>\n        .with_columns<span style=\"color: #c678dd;\">(<\/span><span style=\"color: #98be65;\">[<\/span><span style=\"color: #a9a1e1;\">(<\/span>\n            <span style=\"color: #51afef;\">(<\/span>col<span style=\"color: #c678dd;\">(<\/span>feature<span style=\"color: #c678dd;\">)<\/span> + col<span style=\"color: #c678dd;\">(<\/span>feature<span style=\"color: #c678dd;\">)<\/span>.shift<span style=\"color: #c678dd;\">(<\/span>lit<span style=\"color: #98be65;\">(<\/span>-<span style=\"color: #da8548; font-weight: bold;\">1<\/span><span style=\"color: #98be65;\">)<\/span><span style=\"color: #c678dd;\">)<\/span><span style=\"color: #51afef;\">)<\/span> \/\n                lit<span style=\"color: #51afef;\">(<\/span><span style=\"color: #da8548; font-weight: bold;\">2.0<\/span><span style=\"color: #51afef;\">)<\/span><span style=\"color: #a9a1e1;\">)<\/span>.alias<span style=\"color: #a9a1e1;\">(<\/span><span style=\"color: #98be65;\">\"split\"<\/span><span style=\"color: #a9a1e1;\">)<\/span>\n        <span style=\"color: #98be65;\">]<\/span><span style=\"color: #c678dd;\">)<\/span>\n        .collect<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">split_values<\/span> : <span style=\"color: #ECBE7B;\">Vec<\/span><span style=\"color: #c678dd;\">&lt;<\/span><span style=\"color: #ECBE7B;\">f64<\/span><span style=\"color: #c678dd;\">&gt;<\/span> = split\n        .column<span style=\"color: #c678dd;\">(<\/span><span style=\"color: #98be65;\">\"split\"<\/span><span style=\"color: #c678dd;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>\n        .<span style=\"color: #ECBE7B;\">f64<\/span><span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>\n        .iter<span style=\"color: #c678dd;\">()<\/span>\n        .flatten<span style=\"color: #c678dd;\">()<\/span> <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">drop missing values created by lag<\/span>\n        .collect<span style=\"color: #c678dd;\">()<\/span>;\n\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">iterate over split points<\/span>\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">metrics<\/span>: <span style=\"color: #ECBE7B;\">PolarsResult<\/span><span style=\"color: #c678dd;\">&lt;<\/span><span style=\"color: #ECBE7B;\">Series<\/span><span style=\"color: #c678dd;\">&gt;<\/span> = split_values\n        .iter<span style=\"color: #c678dd;\">()<\/span>\n        .map<span style=\"color: #c678dd;\">(<\/span>|sp| <span style=\"color: #98be65;\">{<\/span>\n            <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">split dataframe<\/span>\n            <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">higher<\/span> = data.clone<span style=\"color: #a9a1e1;\">()<\/span>.filter<span style=\"color: #a9a1e1;\">(<\/span>&amp; values.gt_eq<span style=\"color: #51afef;\">(<\/span>*sp<span style=\"color: #51afef;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span><span style=\"color: #a9a1e1;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n            <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">lower<\/span> = data.clone<span style=\"color: #a9a1e1;\">()<\/span>.filter<span style=\"color: #a9a1e1;\">(<\/span>&amp; values.lt<span style=\"color: #51afef;\">(<\/span>*sp<span style=\"color: #51afef;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span><span style=\"color: #a9a1e1;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n\n            <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">calculate metrics<\/span>\n            <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">higher_metric<\/span> = estimate_gini<span style=\"color: #a9a1e1;\">(<\/span>&amp; higher, target<span style=\"color: #a9a1e1;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n            <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">lower_metric<\/span> = estimate_gini<span style=\"color: #a9a1e1;\">(<\/span>&amp; lower, target<span style=\"color: #a9a1e1;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n\n            <span style=\"color: #ECBE7B;\">Ok<\/span><span style=\"color: #a9a1e1;\">(<\/span>\n                <span style=\"color: #51afef;\">(<\/span><span style=\"color: #c678dd;\">(<\/span>higher.shape<span style=\"color: #98be65;\">()<\/span>.<span style=\"color: #da8548; font-weight: bold;\">0<\/span> <span style=\"color: #51afef;\">as<\/span> <span style=\"color: #ECBE7B;\">f64<\/span><span style=\"color: #c678dd;\">)<\/span> * higher_metric\n                 + <span style=\"color: #c678dd;\">(<\/span>lower.shape<span style=\"color: #98be65;\">()<\/span>.<span style=\"color: #da8548; font-weight: bold;\">0<\/span> <span style=\"color: #51afef;\">as<\/span> <span style=\"color: #ECBE7B;\">f64<\/span><span style=\"color: #c678dd;\">)<\/span> * lower_metric<span style=\"color: #51afef;\">)<\/span>\n                    \/ <span style=\"color: #51afef;\">(<\/span>values.len<span style=\"color: #c678dd;\">()<\/span> <span style=\"color: #51afef;\">as<\/span> <span style=\"color: #ECBE7B;\">f64<\/span><span style=\"color: #51afef;\">)<\/span>,\n            <span style=\"color: #a9a1e1;\">)<\/span>\n        <span style=\"color: #98be65;\">}<\/span><span style=\"color: #c678dd;\">)<\/span>\n        .collect<span style=\"color: #c678dd;\">()<\/span>;\n\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">return a dataframe with a metric evaluation<\/span>\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">for each split point<\/span>\n    <span style=\"color: #51afef;\">return<\/span> <span style=\"color: #ECBE7B;\">Ok<\/span><span style=\"color: #c678dd;\">(<\/span><span style=\"color: #51afef; font-weight: bold;\">df!<\/span><span style=\"color: #98be65;\">(<\/span>\n        <span style=\"color: #98be65;\">\"split\"<\/span> =&gt; <span style=\"color: #ECBE7B;\">Series<\/span>::new<span style=\"color: #a9a1e1;\">(<\/span><span style=\"color: #98be65;\">\"split\"<\/span>, split_values<span style=\"color: #a9a1e1;\">)<\/span>,\n        <span style=\"color: #98be65;\">\"metrics\"<\/span> =&gt; metrics<span style=\"color: #c678dd; font-weight: bold;\">?<\/span>,\n    <span style=\"color: #98be65;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span><span style=\"color: #c678dd;\">)<\/span>;\n<span style=\"color: #51afef;\">}<\/span>\n<\/pre>\n<\/div>\n\n<p> Here are the plots of the metric at the root node: it appears that some metrics have more than one local minimum <\/p>\n\n<div id=\"org24e1075\" class=\"figure\"> <p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/petal_length_plot.png?ssl=1\" alt=\"petal_length_plot.png\" \/> <\/p> <\/div>\n\n<div id=\"org7c382ba\" class=\"figure\"> <p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/petal_width_plot.png?ssl=1\" alt=\"petal_width_plot.png\" \/> <\/p> <\/div>\n\n<div id=\"org735eb40\" class=\"figure\"> <p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/sepal_length_plot.png?ssl=1\" alt=\"sepal_length_plot.png\" \/> <\/p> <\/div>\n\n<div id=\"org34b3714\" class=\"figure\"> <p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/sepal_width_plot.png?ssl=1\" alt=\"sepal_width_plot.png\" \/> <\/p> <\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-org1cc1f87\" class=\"outline-2\">\n<h2 id=\"org1cc1f87\">Predicting a category<\/h2>\n<div class=\"outline-text-2\" id=\"text-org1cc1f87\">\n<p> Given the dataset associated to a decision tree node we should find a way to return the predicted class: it can be done by choosing the most populated class. <\/p>\n\n<p> In case of equally populated class just grab the first one it finds. In this implementation I do not return the probability, but in I will add this in the next posts. <\/p>\n\n<div class=\"org-src-container\">\n<label class=\"org-src-name\"><em><\/em><\/label>\n<pre class=\"src src-rust\" id=\"nil\"><span style=\"color: #51afef;\">fn<\/span> <span style=\"color: #c678dd;\">predict_majority_dataframe<\/span><span style=\"color: #51afef;\">(<\/span><span style=\"color: #dcaeea;\">data<\/span>: &amp; <span style=\"color: #ECBE7B;\">DataFrame<\/span>, <span style=\"color: #dcaeea;\">target<\/span>: &amp; <span style=\"color: #ECBE7B;\">str<\/span><span style=\"color: #51afef;\">)<\/span> -&gt; <span style=\"color: #ECBE7B;\">PolarsResult<\/span><span style=\"color: #51afef;\">&lt;<\/span><span style=\"color: #ECBE7B;\">String<\/span><span style=\"color: #51afef;\">&gt;{<\/span>\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">extract the categorical target column<\/span>\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">labels<\/span> = data\n        .column<span style=\"color: #c678dd;\">(<\/span>target<span style=\"color: #c678dd;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>\n        .categorical<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">count all categories and sort them<\/span>\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">result_count<\/span> = labels.value_counts<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n    <span style=\"color: #c678dd;\">println!<\/span><span style=\"color: #c678dd;\">(<\/span><span style=\"color: #98be65;\">\"<\/span><span style=\"color: #98be65; font-style: italic;\">{1:-&gt;0$}{2:?}{1:-&lt;0$}<\/span><span style=\"color: #98be65;\">\"<\/span>,<span style=\"color: #da8548; font-weight: bold;\">20<\/span>,<span style=\"color: #98be65;\">\"\\n\"<\/span>,result_count<span style=\"color: #c678dd;\">)<\/span>;\n\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">get the most frequent category<\/span>\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">result_cat<\/span> = result_count\n        .column<span style=\"color: #c678dd;\">(<\/span>target<span style=\"color: #c678dd;\">)<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>\n        .head<span style=\"color: #c678dd;\">(<\/span><span style=\"color: #ECBE7B;\">Some<\/span><span style=\"color: #98be65;\">(<\/span><span style=\"color: #da8548; font-weight: bold;\">1<\/span><span style=\"color: #98be65;\">)<\/span><span style=\"color: #c678dd;\">)<\/span>;\n    <span style=\"color: #c678dd;\">println!<\/span><span style=\"color: #c678dd;\">(<\/span><span style=\"color: #98be65;\">\"<\/span><span style=\"color: #98be65; font-style: italic;\">{1:-&gt;0$}{2:?}{1:-&lt;0$}<\/span><span style=\"color: #98be65;\">\"<\/span>,<span style=\"color: #da8548; font-weight: bold;\">20<\/span>,<span style=\"color: #98be65;\">\"\\n\"<\/span>,result_cat<span style=\"color: #c678dd;\">)<\/span>;\n\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">transform the series into a categorical vector<\/span>\n    <span style=\"color: #51afef;\">let<\/span> actual_cat= result_cat\n        .categorical<span style=\"color: #c678dd;\">()<\/span><span style=\"color: #c678dd; font-weight: bold;\">?<\/span>;\n\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">collect all categories as strings<\/span>\n    <span style=\"color: #51afef;\">let<\/span> <span style=\"color: #dcaeea;\">string_cat<\/span>: <span style=\"color: #ECBE7B;\">Vec<\/span><span style=\"color: #c678dd;\">&lt;<\/span><span style=\"color: #ECBE7B;\">String<\/span><span style=\"color: #c678dd;\">&gt;<\/span>=actual_cat\n        .iter_str<span style=\"color: #c678dd;\">()<\/span>\n        .flatten<span style=\"color: #c678dd;\">()<\/span>\n        .map<span style=\"color: #c678dd;\">(<\/span>|name| <span style=\"color: #98be65;\">(<\/span>*name<span style=\"color: #98be65;\">)<\/span>.into<span style=\"color: #98be65;\">()<\/span><span style=\"color: #c678dd;\">)<\/span>\n        .collect<span style=\"color: #c678dd;\">()<\/span>;\n    <span style=\"color: #c678dd;\">println!<\/span><span style=\"color: #c678dd;\">(<\/span><span style=\"color: #98be65;\">\"<\/span><span style=\"color: #98be65; font-style: italic;\">{1:-&gt;0$}{2:?}{1:-&lt;0$}<\/span><span style=\"color: #98be65;\">\"<\/span>,<span style=\"color: #da8548; font-weight: bold;\">20<\/span>,<span style=\"color: #98be65;\">\"\\n\"<\/span>,string_cat<span style=\"color: #c678dd;\">)<\/span>;\n\n    <span style=\"color: #5B6268;\">\/\/ <\/span><span style=\"color: #5B6268;\">return the most common category as a string<\/span>\n    <span style=\"color: #51afef;\">return<\/span> <span style=\"color: #ECBE7B;\">Ok<\/span><span style=\"color: #c678dd;\">(<\/span>string_cat.get<span style=\"color: #98be65;\">(<\/span><span style=\"color: #da8548; font-weight: bold;\">0<\/span><span style=\"color: #98be65;\">)<\/span>\n        .unwrap<span style=\"color: #98be65;\">()<\/span>\n        .deref<span style=\"color: #98be65;\">()<\/span>\n        .into<span style=\"color: #98be65;\">()<\/span><span style=\"color: #c678dd;\">)<\/span>;\n<span style=\"color: #51afef;\">}<\/span>\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"Starting a decision tree in Rust","protected":false},"author":1,"featured_media":464,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[27],"tags":[5],"class_list":["post-469","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-rust"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Sowing a (Decision) Tree - Noise On The Net<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sowing a (Decision) Tree - Noise On The Net\" \/>\n<meta property=\"og:description\" content=\"Starting a decision tree in Rust\" \/>\n<meta property=\"og:url\" content=\"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/\" \/>\n<meta property=\"og:site_name\" content=\"Noise On The Net\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-12T15:57:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-12T21:46:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"marco.p.v.vezzoli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"marco.p.v.vezzoli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/\"},\"author\":{\"name\":\"marco.p.v.vezzoli\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\"},\"headline\":\"Sowing a (Decision) Tree\",\"datePublished\":\"2024-05-12T15:57:00+00:00\",\"dateModified\":\"2024-05-12T21:46:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/\"},\"wordCount\":572,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\"},\"image\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1\",\"keywords\":[\"Rust\"],\"articleSection\":[\"Machine learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/\",\"url\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/\",\"name\":\"Sowing a (Decision) Tree - Noise On The Net\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1\",\"datePublished\":\"2024-05-12T15:57:00+00:00\",\"dateModified\":\"2024-05-12T21:46:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1\",\"width\":1200,\"height\":900},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2024\\\/05\\\/sowing-a-decision-tree\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sowing a (Decision) Tree\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#website\",\"url\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/\",\"name\":\"Noise On The Net\",\"description\":\"Sharing adventures in code\",\"publisher\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\",\"name\":\"marco.p.v.vezzoli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g\",\"caption\":\"marco.p.v.vezzoli\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g\"},\"description\":\"Self taught assembler programming at 11 on my C64 (1983). Never stopped since then -- always looking up for curious things in the software development, data science and AI. Linux and FOSS user since 1994. MSc in physics in 1996. Working in large semiconductor companies since 1997 (STM, Micron) developing analytics and full stack web infrastructures, microservices, ML solutions\",\"sameAs\":[\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/marco-paolo-valerio-vezzoli-0663835\\\/\"],\"url\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/author\\\/marco-p-v-vezzoli\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Sowing a (Decision) Tree - Noise On The Net","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/","og_locale":"en_US","og_type":"article","og_title":"Sowing a (Decision) Tree - Noise On The Net","og_description":"Starting a decision tree in Rust","og_url":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/","og_site_name":"Noise On The Net","article_published_time":"2024-05-12T15:57:00+00:00","article_modified_time":"2024-05-12T21:46:02+00:00","og_image":[{"width":1200,"height":900,"url":"https:\/\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg","type":"image\/jpeg"}],"author":"marco.p.v.vezzoli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"marco.p.v.vezzoli","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/#article","isPartOf":{"@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/"},"author":{"name":"marco.p.v.vezzoli","@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982"},"headline":"Sowing a (Decision) Tree","datePublished":"2024-05-12T15:57:00+00:00","dateModified":"2024-05-12T21:46:02+00:00","mainEntityOfPage":{"@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/"},"wordCount":572,"commentCount":0,"publisher":{"@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982"},"image":{"@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1","keywords":["Rust"],"articleSection":["Machine learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/","url":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/","name":"Sowing a (Decision) Tree - Noise On The Net","isPartOf":{"@id":"https:\/\/noiseonthenet.space\/noise\/#website"},"primaryImageOfPage":{"@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/#primaryimage"},"image":{"@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1","datePublished":"2024-05-12T15:57:00+00:00","dateModified":"2024-05-12T21:46:02+00:00","breadcrumb":{"@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/#primaryimage","url":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1","contentUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1","width":1200,"height":900},{"@type":"BreadcrumbList","@id":"https:\/\/noiseonthenet.space\/noise\/2024\/05\/sowing-a-decision-tree\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/noiseonthenet.space\/noise\/"},{"@type":"ListItem","position":2,"name":"Sowing a (Decision) Tree"}]},{"@type":"WebSite","@id":"https:\/\/noiseonthenet.space\/noise\/#website","url":"https:\/\/noiseonthenet.space\/noise\/","name":"Noise On The Net","description":"Sharing adventures in code","publisher":{"@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/noiseonthenet.space\/noise\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982","name":"marco.p.v.vezzoli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g","caption":"marco.p.v.vezzoli"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g"},"description":"Self taught assembler programming at 11 on my C64 (1983). Never stopped since then -- always looking up for curious things in the software development, data science and AI. Linux and FOSS user since 1994. MSc in physics in 1996. Working in large semiconductor companies since 1997 (STM, Micron) developing analytics and full stack web infrastructures, microservices, ML solutions","sameAs":["https:\/\/noiseonthenet.space\/noise\/","https:\/\/www.linkedin.com\/in\/marco-paolo-valerio-vezzoli-0663835\/"],"url":"https:\/\/noiseonthenet.space\/noise\/author\/marco-p-v-vezzoli\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/05\/ramona-edwards-uKyj-X5qLtU-unsplash_reduced.jpg?fit=1200%2C900&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pdDUZ5-7z","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/comments?post=469"}],"version-history":[{"count":5,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/469\/revisions"}],"predecessor-version":[{"id":483,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/469\/revisions\/483"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/media\/464"}],"wp:attachment":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/media?parent=469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/categories?post=469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/tags?post=469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}