Skip to content

Commit 4cee814

Browse files
committed
Initial Airfoil
1 parent ec9e9b2 commit 4cee814

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

_layout/head.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<li class="pure-menu-item {{ispage end-to-end/crabs-xgb/index.html}}pure-menu-selected{{end}}"><a href="/end-to-end/crabs-xgb/" class="pure-menu-link"><span style="padding-right:0.5rem;"></span> Crabs (XGB)</a></li>
7878
<li class="pure-menu-item "><a href="/end-to-end/horse/" class="pure-menu-link"><span style="padding-right:0.5rem;"></span> Horse</a></li>
7979
<li class="pure-menu-item "><a href="/end-to-end/HouseKingCounty/" class="pure-menu-link"><span style="padding-right:0.5rem;"></span> King County Houses</a></li>
80+
<li class="pure-menu-item "><a href="/end-to-end/airfoil" class="pure-menu-link"><span style="padding-right:0.5rem;"></span> Airfoil </a></li>
8081
</ul>
8182
</ul>
8283
<!-- END OF LIST OF MENU ITEMS -->

_literate/EX-airfoil.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ## Getting started
2+
#
3+
# ### Loading and preparing the data
4+
5+
using MLJ, PrettyPrinting, DataFrames, Statistics, CSV
6+
using PyPlot, HTTP
7+
8+
MLJ.color_off() # hide
9+
10+
req = HTTP.get("https://raw.githubusercontent.com/rupakc/UCI-Data-Analysis/master/Airfoil%20Dataset/airfoil_self_noise.dat");
11+
12+
df = CSV.read(req.body, header=[
13+
"Frequency","Attack_Angle","Chord+Length","Free_Velocity","Suction_Side","Scaled_Sound"
14+
]
15+
);
16+
df[1:5, :] |> pretty
17+
18+
# We load the RandomForestRegressor from ScikitLearn
19+
rfr = @load RandomForestRegressor pkg=ScikitLearn
20+
21+
#-unpack into the data and labels
22+
y, X = unpack(df, ==(:Scaled_Sound), col -> true);
23+
24+
# Partition into train and test set
25+
train, test = partition(eachindex(y), 0.7);
26+
27+
rfr = RandomForestRegressor();
28+
29+
rfr_m = machine(rfr, X, y);
30+
31+
# train on the rows corresponding to train
32+
fit!(rfr_m, rows=train);
33+
34+
# predict values on the rows corresponding to test
35+
pred = MLJ.predict(rfr_m, rows=test);
36+
pred[1:5]

end-to-end/airfoil.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@def hascode = true
2+
@def showall = true
3+
4+
# Airfoil
5+
6+
\tutorial{EX-airfoil}

0 commit comments

Comments
 (0)