From 39e9ce12c3add516383a219bb0c74d55f9662dcf Mon Sep 17 00:00:00 2001 From: Antonello Lobianco Date: Sat, 30 Dec 2023 23:45:48 +0100 Subject: [PATCH] Removed all the `## test..` out of non-code chunks in the .jl files See the Docmuneter bug in https://github.com/JuliaDocs/Documenter.jl/issues/2206 --- .../0001_-_Course_presentation.md | 196 +++++++ .../0002_-_Program.md | 144 +++++ .../0003_-_Introduction_to_Julia.md | 282 +++++++++- .../0003q_-_QUIZ_0.1.md | 144 +++++ .../0004_-_Introduction_to_ML.md | 281 +++++++++- .../0004q_-_QUIZ_0.2.md | 144 +++++ .../0101_-_Basic_syntax.jl | 19 +- .../0101q_-_QUIZ_1.1.md | 144 +++++ .../0101q_-_QUIZ_1.2.md | 144 +++++ .../0102_-_Types_and_objects.jl | 26 +- .../0102q_-_QUIZ_1.3.md | 145 ++++- .../0103_-_Predefined_types.jl | 41 +- .../0103q_-_QUIZ_1.4.md | 144 +++++ .../0103q_-_QUIZ_1.5.md | 145 ++++- .../0103q_-_QUIZ_1.6.md | 144 +++++ .../0104_-_Control_flow_and_functions.jl | 18 +- .../0104q_-_QUIZ_1.7.md | 144 +++++ .../0104q_-_QUIZ_1.8.md | 144 +++++ .../0105_-_Custom_types.jl | 23 +- .../0105q_-_QUIZ_1.10.md | 145 ++++- .../0105q_-_QUIZ_1.9.md | 144 +++++ .../0105x_EXERCISE-1.1.md | 144 +++++ .../0106_-_Further_topics.jl | 20 +- .../0106q_-_QUIZ_1.11.md | 144 +++++ .../0106q_-_QUIZ_1.12.md | 145 ++++- .../0106q_-_QUIZ_1.13.md | 145 ++++- .../0201_-_Wranging_data.jl | 16 +- .../0202_-_Miscellaneous_topics.jl | 30 +- .../0202x_EXERCISE-2.1.md | 181 ++++++- .../0202x_EXERCISE-2.2.md | 181 ++++++- .../0301_-_Machine_learning_main_concepts.md | 350 ++++++++++++ .../0302_-_The_Perceptron_classifier.jl | 18 +- .../0302x_EXERCISE-3.1.md | 180 +++++++ .../0401_-_Neural_network_architectures.md | 504 ++++++++++++++++++ ...ementation_of_neural_networks_workflows.jl | 21 +- .../0402x_EXERCISE-4.1.md | 216 ++++++++ .../0402x_EXERCISE-4.2.md | 217 +++++++- .../0501_-_Decision_trees_based_algorithms.md | 397 +++++++++++++- .../0502x_EXERCISE-5.1.md | 396 ++++++++++++++ makedoc.jl | 1 + 40 files changed, 5931 insertions(+), 136 deletions(-) diff --git a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0001_-_Course_presentation.md b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0001_-_Course_presentation.md index 60a0029..586371c 100644 --- a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0001_-_Course_presentation.md +++ b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0001_-_Course_presentation.md @@ -1,3 +1,55 @@ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 1A: Course introduction (6:3) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 1A: Course introduction (6:3) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 1A: Course introduction (6:3) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 1A: Course introduction (6:3) +
+
+ +
+
+
+
+``` +------ # [Course Presentation](@id course_presentation) @@ -71,3 +123,147 @@ The only 3 conditions are : 3. some sort of interactive tools are proposed to the students, like the quizzes or practical exercises. While the production of videos for your content is welcome, this is not strictly necessary. + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0002_-_Program.md b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0002_-_Program.md index a23f630..df19607 100644 --- a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0002_-_Program.md +++ b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0002_-_Program.md @@ -119,3 +119,147 @@ The slides used in the videos below are available [here](https://github.com/sylv - [Part B - Multinomial classification](https://www.youtube.com/watch?v=fqROq7B6nyY&list=PLDIpPSqVuMmIvTA3w7ATUKHzq82uey8pP&index=8) (15:1) - [Part C - Regression](https://www.youtube.com/watch?v=jO-mfgzo7VY&list=PLDIpPSqVuMmIvTA3w7ATUKHzq82uey8pP&index=9) (6:3) - [Part D - Convolutional neural network](https://www.youtube.com/watch?v=mSUdLu9HAd4&list=PLDIpPSqVuMmIvTA3w7ATUKHzq82uey8pP&index=10) (13:19) + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0003_-_Introduction_to_Julia.md b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0003_-_Introduction_to_Julia.md index e7e7caf..9cd4cca 100644 --- a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0003_-_Introduction_to_Julia.md +++ b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0003_-_Introduction_to_Julia.md @@ -1,3 +1,139 @@ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 3A: Julia overview (36:25) +
+
+ +
+
+
+
00 INTRO - 3B: How to install Julia and git #1 (20:15) +
+
+ +
+
+
+
00 INTRO - 3C: How to install Julia and git #2 (21:54) +
+
+ +
+
+
+
00 INTRO - 3D: Modules, packages and environments (20:56) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 3A: Julia overview (36:25) +
+
+ +
+
+
+
00 INTRO - 3B: How to install Julia and git #1 (20:15) +
+
+ +
+
+
+
00 INTRO - 3C: How to install Julia and git #2 (21:54) +
+
+ +
+
+
+
00 INTRO - 3D: Modules, packages and environments (20:56) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 3A: Julia overview (36:25) +
+
+ +
+
+
+
00 INTRO - 3B: How to install Julia and git #1 (20:15) +
+
+ +
+
+
+
00 INTRO - 3C: How to install Julia and git #2 (21:54) +
+
+ +
+
+
+
00 INTRO - 3D: Modules, packages and environments (20:56) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 3A: Julia overview (36:25) +
+
+ +
+
+
+
00 INTRO - 3B: How to install Julia and git #1 (20:15) +
+
+ +
+
+
+
00 INTRO - 3C: How to install Julia and git #2 (21:54) +
+
+ +
+
+
+
00 INTRO - 3D: Modules, packages and environments (20:56) +
+
+ +
+
+
+
+``` +------ # [Introduction to Julia, git and the Julia package manager](@id introduction_julia) ## An introduction to the Julia Programming Language @@ -276,7 +412,7 @@ A typical module would look like this: ```julia module ModuleName export myObjects # functions, structs, and other objects that will be directly available once `using ModuleName` is typed -[...module code...] +# [...module code...] end ``` @@ -355,3 +491,147 @@ The first line sets the _current directory_ to those of the *.jl file in which t !!! tip Attention to this difference: the **current directory** is the path that serves as a reference when you interact with the operating system for files input/output, for example, to read a Comma Separated File or to save a plot image. The **environment** is the directory where the associated `Metadata.toml` and `Project.toml` files listing all the dependencies reside. The two directories can be the same but also be different. + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0003q_-_QUIZ_0.1.md b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0003q_-_QUIZ_0.1.md index 9aa282f..eb02b53 100644 --- a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0003q_-_QUIZ_0.1.md +++ b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0003q_-_QUIZ_0.1.md @@ -261,3 +261,147 @@ The correct answers are: ```@raw html ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0004_-_Introduction_to_ML.md b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0004_-_Introduction_to_ML.md index a1f9f0a..a3da8bc 100644 --- a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0004_-_Introduction_to_ML.md +++ b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0004_-_Introduction_to_ML.md @@ -1,3 +1,139 @@ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 4A: ML Terminology (21:19) +
+
+ +
+
+
+
00 INTRO - 4B: A first ML Example (7:0) +
+
+ +
+
+
+
00 INTRO - 4C: ML application areas (14:24) +
+
+ +
+
+
+
00 INTRO - 4D: Further ML Examples (6:34) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 4A: ML Terminology (21:19) +
+
+ +
+
+
+
00 INTRO - 4B: A first ML Example (7:0) +
+
+ +
+
+
+
00 INTRO - 4C: ML application areas (14:24) +
+
+ +
+
+
+
00 INTRO - 4D: Further ML Examples (6:34) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 4A: ML Terminology (21:19) +
+
+ +
+
+
+
00 INTRO - 4B: A first ML Example (7:0) +
+
+ +
+
+
+
00 INTRO - 4C: ML application areas (14:24) +
+
+ +
+
+
+
00 INTRO - 4D: Further ML Examples (6:34) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
00 INTRO - 4A: ML Terminology (21:19) +
+
+ +
+
+
+
00 INTRO - 4B: A first ML Example (7:0) +
+
+ +
+
+
+
00 INTRO - 4C: ML application areas (14:24) +
+
+ +
+
+
+
00 INTRO - 4D: Further ML Examples (6:34) +
+
+ +
+
+
+
+``` +------ # An introduction to Machine Learning Now that we have introduced the programming language we'll use in this course, we can enter the second topic of the course, machine learning. But before that, let's just prepare a bit of the work by clarifying the terminology. @@ -176,4 +312,147 @@ Most of the time we start from zero at each task, we "just" train the new model But the key to "learning", at least for intelligent agents, is the capacity to generalise the learned tasks and transfer this knowledge to solve new tasks. Something that goes under the name of "transfer learning". For example, the basic law of physics that a kid learns using her building blocks toys can be used later on in life during adulthood. -We close here this long "introductory" lesson and we'll start in the next lesson to dig a bit more in-depth the topics that we introduced today. \ No newline at end of file +We close here this long "introductory" lesson and we'll start in the next lesson to dig a bit more in-depth the topics that we introduced today. +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0004q_-_QUIZ_0.2.md b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0004q_-_QUIZ_0.2.md index 66266ac..3de4a1d 100644 --- a/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0004q_-_QUIZ_0.2.md +++ b/lessonsSources/00_-_INTRO_-_Introduction_julia_ml/0004q_-_QUIZ_0.2.md @@ -76,3 +76,147 @@ The correct answer is: ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101_-_Basic_syntax.jl b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101_-_Basic_syntax.jl index 9b19ae5..a3ae842 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101_-_Basic_syntax.jl +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101_-_Basic_syntax.jl @@ -1,11 +1,11 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # # 0101 - Basic Syntax Elements @@ -83,14 +83,13 @@ add2.((1,2,3)) # not only for arrays, here is a Tuple add2.(Set([1,2,3,2])) # and here a Set .+([1,2,3],[10,20,30]) # fine here ## .+([1,2,3],[10,20]) # DimensionMismatch error: the input of the the broadcasted arguments must have the same size or be a scalar + # To "protect" one specific argument to be broadcasted, use `Ref(arg)`: foo(x,y::AbstractArray) = [yi+x for yi in y] # a function that wants the first arguent as scalar and the second as vector foo(1,[10,20]) ## foo.([1,2],[10,20]) # error, as we try to broadcast also the seond element, but we can't call `foo` with two integers foo.([1,2],Ref([10,20])) # now it is fine, we broadcast only the first argument - - # ## 1 based arrays # Arrays start indexing at 1 (like R, Fortran, Matlab,...) instead of 0 (like in C, Python, Java...) a = [1,2,3] diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101q_-_QUIZ_1.1.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101q_-_QUIZ_1.1.md index b730c2f..f1a2784 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101q_-_QUIZ_1.1.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101q_-_QUIZ_1.1.md @@ -134,3 +134,147 @@ The correct answer is: ```@raw html ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101q_-_QUIZ_1.2.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101q_-_QUIZ_1.2.md index 32d2bc9..2221d82 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101q_-_QUIZ_1.2.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0101q_-_QUIZ_1.2.md @@ -83,3 +83,147 @@ The correct answers is: `211` ```@raw html ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0102_-_Types_and_objects.jl b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0102_-_Types_and_objects.jl index b3938af..439a510 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0102_-_Types_and_objects.jl +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0102_-_Types_and_objects.jl @@ -1,16 +1,14 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # # 0102 Types and objects - - # ## Some stuff to set-up the environment.. cd(@__DIR__) @@ -70,14 +68,14 @@ typeof(b) # - ... # Complete Number hierarchy: [https://upload.wikimedia.org/wikipedia/commons/d/d9/Julia-number-type-hierarchy.svg](https://upload.wikimedia.org/wikipedia/commons/d/d9/Julia-number-type-hierarchy.svg) -## Everythong is an object, i.e. of some "type" +# Everythong is an object, i.e. of some "type": c = typeof(a) typeof(c) d = sin typeof(d) <: Function typeof(+) <: Function -## Operators are just functions: +# Operators are just functions: 1 + 2 +(1,2) # this call the function "+" import Base.+ @@ -103,7 +101,7 @@ m === k # are the two identifiers binding the same identical object in memory # ## Mutability property of Julia objects - +# Mutable objects are stored in memory "directly", while for mutable objects it is its memory address to be stored: k = 10 v = [1,2] p = 'z' @@ -112,8 +110,6 @@ ismutable(k) ismutable(v) ismutable(p) ismutable(g) -## mutable objects are stored in memory "directly", while for mutable objects it is its memory address to be stored - # ## Three different ways to "copy" objects... diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0102q_-_QUIZ_1.3.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0102q_-_QUIZ_1.3.md index 6a4c344..e66dc74 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0102q_-_QUIZ_1.3.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0102q_-_QUIZ_1.3.md @@ -86,4 +86,147 @@ The correct answer is: 120 ```@raw html -``` \ No newline at end of file +``` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103_-_Predefined_types.jl b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103_-_Predefined_types.jl index a823705..214323e 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103_-_Predefined_types.jl +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103_-_Predefined_types.jl @@ -1,11 +1,11 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # # 0103 Predefined types @@ -34,9 +34,9 @@ b = a[2] typeof(b) b = a[3:end] typeof(b) -#a[2] = 'E' # error ! +## a[2] = 'E' # error ! -## info... +# Information... ismutable(a) # long story.... https://github.com/JuliaLang/julia/issues/30210 length(a) findfirst(isequal('o'), a) @@ -49,14 +49,14 @@ endswith(a,"ld ") startswith(a,"Mooo") occursin(r"H*.d ", a) -## modifications.. +# Modifications.. lowercase(a) lowercasefirst(a) split(a, " ") replace(a,"World" => "Universe") strip(a) -## concatenation.. +# Concatenation.. a = "Hello"; b= "World" c = join([a,b]," ") c = a*" "*b @@ -70,9 +70,9 @@ b = string(2019) # !!! warning # Attention not to confuse the `string` function with the `String` type and the `String()` constructor! -## to know more... +# to know more... methodswith(String,supertypes=true); # where any argument is a String or any parent type (such e.g. AbstractString) -## See also https://docs.julialang.org/en/v1/manual/strings/ +# See also https://docs.julialang.org/en/v1/manual/strings/ # ## Arrays - `Array{T,N}` @@ -175,7 +175,7 @@ findall(x -> myComparitionWith1(x), [2,1,3,1]) filter(i -> i > 2, [1,2,3,4]) -## delete [7,2,5] from an 1:10 array: +# Delete `[7,2,5] from an `1:10` array: data = [1:10;] toDelete = [7,5,2] deleteat!(data, findall(x -> x in toDelete, data)) @@ -200,7 +200,7 @@ a = [1 4; 2 5; 3 6] # By row, i.e. elements of the first row, elements of the ## Empty (zero-elements) arrays: a = Array{Float64}(undef, 0, 0, 0) # using explicitly the constructor and explicitly giving zero for each wanted dimension -## n-elements initialisation: +# n-elements initialisation: (T,n,m,g,j) = (Int64,1,2,3,'a') a = zeros(n,m,g) # n,m,g-elements zeros array a = ones(n,m,g) # n,m,g-elements ones array @@ -484,7 +484,8 @@ Dates.format(newYearDay, "dd/m/yy") Dates.format(christmasLunch, "dd/mm/yy H:M:SS") # Other... -## Date and DateTime... + +# - Date and DateTime... year(christmasDay) isleapyear(christmasDay) month(christmasLunch) @@ -495,7 +496,7 @@ dayname(christmasDay) daysofweekinmonth(christmasDay) # there are 4 Wednesdays in December 2030 dayofweekofmonth(christmasDay) # and the 25th is the 4th of them -## Only datetime.. +# - Only datetime.. hour(christmasLunch) minute(christmasLunch) second(christmasLunch) @@ -505,7 +506,7 @@ second(christmasLunch) hollidayPeriod = newYearDay - christmasDay # between dates is in days longPeriod = Date(2035,6,1) - christmasDay mealPeriod = DateTime(2030,12,31,23,30) - newYearEvenDinner # between datetime is in milliseconds -#newYearDay - newYearEvenDinner # error! no mixed +## newYearDay - newYearEvenDinner # error! no mixed convert(DateTime,newYearDay) convert(Date,newYearEvenDinner) # possible information loss mealPeriod = convert(DateTime,newYearDay) - newYearEvenDinner @@ -528,7 +529,7 @@ typeof(mealPeriod) # - `Nanosecond` -#convert(Dates.Year,longPeriod) # going up: error or inexacterror +## convert(Dates.Year,longPeriod) # going up: error or inexacterror convert(Dates.Millisecond,longPeriod) # going down: fine convert(Dates.Millisecond,mealPeriod) diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.4.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.4.md index b2c6359..f7ea6c9 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.4.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.4.md @@ -99,3 +99,147 @@ The correct answers are: ```@raw html ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.5.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.5.md index 3b28dd0..d24f1ab 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.5.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.5.md @@ -148,4 +148,147 @@ The correct answer is: 3 ```@raw html -``` \ No newline at end of file +``` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.6.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.6.md index 9c985e9..e51cc22 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.6.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0103q_-_QUIZ_1.6.md @@ -193,3 +193,147 @@ The correct answer is: `dayofweek` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104_-_Control_flow_and_functions.jl b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104_-_Control_flow_and_functions.jl index d217711..b5144bb 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104_-_Control_flow_and_functions.jl +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104_-_Control_flow_and_functions.jl @@ -1,11 +1,11 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # ## 0104 Control Flow and Functions @@ -226,7 +226,7 @@ foo(10,a=10,b=20,y="bbb") ## foo(a::String="aaa",b::Int64) = "$a "+string(b) # error! Optional positional argument before a mandatory positional one - +foo(b::Int64,a::String="aaa") = "$a "+string(b) # fine! # ### Argument types and multiple dispatch diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104q_-_QUIZ_1.7.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104q_-_QUIZ_1.7.md index c7f758a..a0d0770 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104q_-_QUIZ_1.7.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104q_-_QUIZ_1.7.md @@ -130,3 +130,147 @@ The correct answers are: ```@raw html ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104q_-_QUIZ_1.8.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104q_-_QUIZ_1.8.md index cf6dc76..c2ec349 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104q_-_QUIZ_1.8.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0104q_-_QUIZ_1.8.md @@ -251,3 +251,147 @@ The correct answers are: ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105_-_Custom_types.jl b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105_-_Custom_types.jl index 739b577..ab78953 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105_-_Custom_types.jl +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105_-_Custom_types.jl @@ -1,15 +1,14 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # # 0105 Custom Types - # ## Some stuff to set-up the environment.. cd(@__DIR__) @@ -81,11 +80,11 @@ mutable struct Foo2 return new(f1+f2,f3) end end -Foo2(1,2,"aaa") # !!! tip # If any inner constructor method is defined, no default constructor method is provided. +Foo2(1,2,"aaa") ## Foo2(1,"aaa") # Error, no default constructor ! # You can also use a macro (requires Julia 1.1) to automatically define an (outer) keyword_based constructor with support for optional arguments: @@ -99,11 +98,8 @@ Kfoo(z=3) # Note that, at time of writing, `@kwdef` is not exported by Julia base, meaning that while widely used, it is considered still "experimental" and its usage may change in future Julia minor versions. - - # ## Custom pretty-printing - # We can customise the way our custom type is rendered by overriding the `Base.show` function for our specific type. # We first need to import `Base.show` @@ -176,7 +172,6 @@ getPlane(intMatrixInside,1,2) # A package where non-type parameters are emploied to boost speed is [StaticArray.jl](https://github.com/JuliaArrays/StaticArrays.jl) where one parameter is the _size_ of the array that hence become known at compile time - # ## Inheritance abstract type MyOwnGenericAbstractType end # the highest-level diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105q_-_QUIZ_1.10.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105q_-_QUIZ_1.10.md index 0d3a48d..aa09405 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105q_-_QUIZ_1.10.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105q_-_QUIZ_1.10.md @@ -121,4 +121,147 @@ The correct answers are: ```@raw html -``` \ No newline at end of file +``` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105q_-_QUIZ_1.9.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105q_-_QUIZ_1.9.md index 95fa8f8..6470fd8 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105q_-_QUIZ_1.9.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105q_-_QUIZ_1.9.md @@ -182,3 +182,147 @@ The correct answer is: `new{T}` ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105x_EXERCISE-1.1.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105x_EXERCISE-1.1.md index da0fe29..c5c5af9 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105x_EXERCISE-1.1.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0105x_EXERCISE-1.1.md @@ -261,3 +261,147 @@ You can try to implement variations of this model. Some ideas: - run Monte-Carlo simulations with respect to the tolerance threshold, with it being a property of the agent rather than of the group, perhaps with the group having a certain distribution of it and each agent of that group sampling from it; - implement two thresholds, with one to define happiness and one to define the actual decision to move (to consider costs associated with relocation); - .... + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106_-_Further_topics.jl b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106_-_Further_topics.jl index c9b5952..ace303c 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106_-_Further_topics.jl +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106_-_Further_topics.jl @@ -1,15 +1,14 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # # 0106 Further Topics - # ## Some stuff to set-up the environment.. cd(@__DIR__) @@ -203,6 +202,7 @@ b = ccall((:mySum,myclib), Float64, (Float32,Float32), 2.5, 1.5) # The "default" way to use Python code in Julia is trough the [PyCall.jl](https://github.com/JuliaPy/PyCall.jl) package. It automatically take care of convert between Python types (including numpy arrays) and Julia types (types that can not be converted automatically are converted to the generic `PyObject` type). ENV["PYTHON"] = "" # will force PyCall to download and use a "private to Julia" (conda based) version of Python. use "/path/to/python" if you want to reuse a version already installed on your system + ## using Pkg ## Pkg.add("PyCall") ## Pkg.build("PyCall") @@ -316,6 +316,7 @@ destDoc.save() # To use R from within Julia we use the [RCall](https://github.com/JuliaInterop/RCall.jl) package. ENV["R_HOME"] = "*" # # will force RCall to download and use a "private to Julia" (conda based) version of R. use "/path/to/R/directory" (e.g. `/usr/lib/R`) if you want to reuse a version already installed on your system + ## using Pkg ## Pkg.add("RCall") ## Pkg.build("RCall") @@ -712,6 +713,7 @@ sizeof(2) # bytes typemin(Int64) typemax(Int64) bitstring(2) + # Various low-level interpretation of an expression @code_native foo(3) @code_llvm foo(3) diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.11.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.11.md index 7f4f5c0..e2ebb84 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.11.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.11.md @@ -163,3 +163,147 @@ The correct answers are: ```@raw html ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.12.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.12.md index 85a3a75..391ea52 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.12.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.12.md @@ -198,4 +198,147 @@ The correct answers are: ```@raw html -``` \ No newline at end of file +``` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.13.md b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.13.md index e405400..ed75024 100644 --- a/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.13.md +++ b/lessonsSources/01_-_JULIA1_-_Basic_Julia_programming/0106q_-_QUIZ_1.13.md @@ -200,4 +200,147 @@ The correct answers are: ```@raw html -``` \ No newline at end of file +``` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0201_-_Wranging_data.jl b/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0201_-_Wranging_data.jl index 87433cb..8c26fbc 100644 --- a/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0201_-_Wranging_data.jl +++ b/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0201_-_Wranging_data.jl @@ -1,11 +1,11 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # # 0201 - Data Wrangling diff --git a/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202_-_Miscellaneous_topics.jl b/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202_-_Miscellaneous_topics.jl index b8c57ef..a1ab5a7 100644 --- a/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202_-_Miscellaneous_topics.jl +++ b/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202_-_Miscellaneous_topics.jl @@ -1,11 +1,11 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # # 0202 - Miscellaneous topics @@ -327,9 +327,7 @@ y = Dict( "ChΓͺne pΓ©donculΓ©" => 1.83933333333333, # for each element of an array Οƒ = Dict((i,j) => Οƒtable[i_ix,j_ix] for (i_ix,i) in enumerate(species), (j_ix,j) in enumerate(species)) -################################################################################ -###### Showing the possible mean/variance of the portfolio by simulation ####### -################################################################################ +# #### Showing the possible mean/variance of the portfolio by simulation nSamples = 1000 shares = rand(nSamples,nSpecies); @@ -349,9 +347,7 @@ scatter(pScores[:,1],pScores[:,2],colour=:blue) savefig("currentPlot13.svg"); #src # ![](currentPlot13.svg) -################################################################################ -### Finding (one) optimal portfolio ############################################ -################################################################################ +# #### Finding (one) optimal portfolio # Risk aversion coefficient Ξ± = 0.1 @@ -368,12 +364,6 @@ end # We declare the constraint shat the sum of shares must be equal to 1 @constraint(port, c_share, sum(x[i] for i in species) == 1) -#= -@objective port Min begin - Ξ± * sum(x[i] * x[j] * Οƒ[i,j] for i in species for j in species) - sum(x[i] * y[i] for i in species) -end -=# - @NLobjective port Min Ξ± * sum(x[i] * x[j] * Οƒ[i,j] for i in species for j in species) - sum(x[i] * y[i] for i in species) # Print the optimisation model in nice human-readable format: diff --git a/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202x_EXERCISE-2.1.md b/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202x_EXERCISE-2.1.md index 0733caa..ebd3438 100644 --- a/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202x_EXERCISE-2.1.md +++ b/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202x_EXERCISE-2.1.md @@ -338,4 +338,183 @@ end ``` ```@raw html -``` \ No newline at end of file +``` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202x_EXERCISE-2.2.md b/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202x_EXERCISE-2.2.md index e83617d..b1bd92d 100644 --- a/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202x_EXERCISE-2.2.md +++ b/lessonsSources/02_-_JULIA2_-_Scientific_programming_with_Julia/0202x_EXERCISE-2.2.md @@ -314,4 +314,183 @@ end ``` ```@raw html -``` \ No newline at end of file +``` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0301_-_Machine_learning_main_concepts.md b/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0301_-_Machine_learning_main_concepts.md index acb2854..5a9255f 100644 --- a/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0301_-_Machine_learning_main_concepts.md +++ b/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0301_-_Machine_learning_main_concepts.md @@ -1,3 +1,173 @@ +```@raw html +
+Videos related to this segment (click the title to watch) +
03 ML1 - 1A: Introduction, perceptron overall idea (11:23) +
+
+ +
+
+
+
03 ML1 - 1B: Hyperparameters and cross-validation (15:18) +
+
+ +
+
+
+
03 ML1 - 1C: The perceptron algorithm (9:53) +
+
+ +
+
+
+
03 ML1 - 1D: SVM and non-linear classification with linear classifiers (8:9) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
03 ML1 - 1A: Introduction, perceptron overall idea (11:23) +
+
+ +
+
+
+
03 ML1 - 1B: Hyperparameters and cross-validation (15:18) +
+
+ +
+
+
+
03 ML1 - 1C: The perceptron algorithm (9:53) +
+
+ +
+
+
+
03 ML1 - 1D: SVM and non-linear classification with linear classifiers (8:9) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
03 ML1 - 1A: Introduction, perceptron overall idea (11:23) +
+
+ +
+
+
+
03 ML1 - 1B: Hyperparameters and cross-validation (15:18) +
+
+ +
+
+
+
03 ML1 - 1C: The perceptron algorithm (9:53) +
+
+ +
+
+
+
03 ML1 - 1D: SVM and non-linear classification with linear classifiers (8:9) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
03 ML1 - 1A: Introduction, perceptron overall idea (11:23) +
+
+ +
+
+
+
03 ML1 - 1B: Hyperparameters and cross-validation (15:18) +
+
+ +
+
+
+
03 ML1 - 1C: The perceptron algorithm (9:53) +
+
+ +
+
+
+
03 ML1 - 1D: SVM and non-linear classification with linear classifiers (8:9) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
03 ML1 - 1A: Introduction, perceptron overall idea (11:23) +
+
+ +
+
+
+
03 ML1 - 1B: Hyperparameters and cross-validation (15:18) +
+
+ +
+
+
+
03 ML1 - 1C: The perceptron algorithm (9:53) +
+
+ +
+
+
+
03 ML1 - 1D: SVM and non-linear classification with linear classifiers (8:9) +
+
+ +
+
+
+
+``` +------ # 0301 - Machine Learning - main concepts We start our journey on Machine Learning from the perceptron algorithm. This is a linear classifier that historically has been a bit a pioneer in ML algorithms. We start from it due to its simplicity, and it will be the only algorithm that we will study in detail. @@ -140,3 +310,183 @@ This is the main difference between linear algorithms used together with feature + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0302_-_The_Perceptron_classifier.jl b/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0302_-_The_Perceptron_classifier.jl index b248376..abe6bb8 100644 --- a/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0302_-_The_Perceptron_classifier.jl +++ b/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0302_-_The_Perceptron_classifier.jl @@ -1,11 +1,11 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +# ################################################################################ +# ### Introduction to Scientific Programming and Machine Learning with Julia ### +# ### ### +# ### Run each script on a new clean Julia session ### +# ### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### +# ### Licence (apply to all material of the course: scripts, videos, quizes,..)### +# ### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### +# ################################################################################ # # 0302 - The Perceptron algorithm for linear classification @@ -257,7 +257,7 @@ print(cfOut) res = info(cfOut) heatmap(string.(res["categories"]),string.(res["categories"]),res["normalised_scores"],seriescolor=cgrad([:white,:blue]),xlabel="Predicted",ylabel="Actual", title="Confusion Matrix (normalised scores)") -# Lets use CrossValidation +# Let's use CrossValidation ((xtrain,xvalidation,xtest),(ytrain,yvalidation,ytest)) = partition([X,y],[0.6,0.2,0.2]) ## Very few records..... let's go back to using only two subsets but with CrossValidation ((xtrain,xtest),(ytrain,ytest)) = partition([X,y],[0.6,0.4]) diff --git a/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0302x_EXERCISE-3.1.md b/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0302x_EXERCISE-3.1.md index b253602..76a38ac 100644 --- a/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0302x_EXERCISE-3.1.md +++ b/lessonsSources/03_-_ML1_-_Introduction_to_Machine_Learning/0302x_EXERCISE-3.1.md @@ -498,3 +498,183 @@ testAccuracy = accuracy(yΜ‚test,ytest) # ```julia plot2DClassifierWithData(xtest,ytest,m.ΞΈ,xlabel="Tumor Radius", ylabel="Tumor Texture") ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/04_-_NN_-_Neural_Networks/0401_-_Neural_network_architectures.md b/lessonsSources/04_-_NN_-_Neural_Networks/0401_-_Neural_network_architectures.md index ba94dbe..b76c8c1 100644 --- a/lessonsSources/04_-_NN_-_Neural_Networks/0401_-_Neural_network_architectures.md +++ b/lessonsSources/04_-_NN_-_Neural_Networks/0401_-_Neural_network_architectures.md @@ -1,3 +1,291 @@ +```@raw html +
+Videos related to this segment (click the title to watch) +
04 NN - 1A: Introduction and motivations (5:32) +
+
+ +
+
+
+
04 NN - 1B: Feed-forward neural networks (18:57) +
+
+ +
+
+
+
04 NN - 1C: How to train a neural network (18:4) +
+
+ +
+
+
+
04 NN - 1D: Convolutional neural networks (13:21) +
+
+ +
+
+
+
04 NN - 1E: Multiple layers in convolutional neural networks (10:33) +
+
+ +
+
+
+
04 NN - 1F: Recurrent neural networks (17:49) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
04 NN - 1A: Introduction and motivations (5:32) +
+
+ +
+
+
+
04 NN - 1B: Feed-forward neural networks (18:57) +
+
+ +
+
+
+
04 NN - 1C: How to train a neural network (18:4) +
+
+ +
+
+
+
04 NN - 1D: Convolutional neural networks (13:21) +
+
+ +
+
+
+
04 NN - 1E: Multiple layers in convolutional neural networks (10:33) +
+
+ +
+
+
+
04 NN - 1F: Recurrent neural networks (17:49) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
04 NN - 1A: Introduction and motivations (5:32) +
+
+ +
+
+
+
04 NN - 1B: Feed-forward neural networks (18:57) +
+
+ +
+
+
+
04 NN - 1C: How to train a neural network (18:4) +
+
+ +
+
+
+
04 NN - 1D: Convolutional neural networks (13:21) +
+
+ +
+
+
+
04 NN - 1E: Multiple layers in convolutional neural networks (10:33) +
+
+ +
+
+
+
04 NN - 1F: Recurrent neural networks (17:49) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
04 NN - 1A: Introduction and motivations (5:32) +
+
+ +
+
+
+
04 NN - 1B: Feed-forward neural networks (18:57) +
+
+ +
+
+
+
04 NN - 1C: How to train a neural network (18:4) +
+
+ +
+
+
+
04 NN - 1D: Convolutional neural networks (13:21) +
+
+ +
+
+
+
04 NN - 1E: Multiple layers in convolutional neural networks (10:33) +
+
+ +
+
+
+
04 NN - 1F: Recurrent neural networks (17:49) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
04 NN - 1A: Introduction and motivations (5:32) +
+
+ +
+
+
+
04 NN - 1B: Feed-forward neural networks (18:57) +
+
+ +
+
+
+
04 NN - 1C: How to train a neural network (18:4) +
+
+ +
+
+
+
04 NN - 1D: Convolutional neural networks (13:21) +
+
+ +
+
+
+
04 NN - 1E: Multiple layers in convolutional neural networks (10:33) +
+
+ +
+
+
+
04 NN - 1F: Recurrent neural networks (17:49) +
+
+ +
+
+
+
+``` +------ +```@raw html +
+Videos related to this segment (click the title to watch) +
04 NN - 1A: Introduction and motivations (5:32) +
+
+ +
+
+
+
04 NN - 1B: Feed-forward neural networks (18:57) +
+
+ +
+
+
+
04 NN - 1C: How to train a neural network (18:4) +
+
+ +
+
+
+
04 NN - 1D: Convolutional neural networks (13:21) +
+
+ +
+
+
+
04 NN - 1E: Multiple layers in convolutional neural networks (10:33) +
+
+ +
+
+
+
04 NN - 1F: Recurrent neural networks (17:49) +
+
+ +
+
+
+
+``` +------ # 0401 - Neural Networks architectures While powerful, neural networks are actually composed of very simple units that are akin to linear classification or regression methods. @@ -331,3 +619,219 @@ The decoding part happens hence at each step of the sequence and the resulting $ While theoretically RNN can "learn" the importance of features across indeterminately long sequence steps, in practice the fact of continuing multiplicating the status across the varius elements of the sequence makes the problem of vanishing gradient even stronger for them. New contributions have hence been proposed with a "gating" system that "learns" what to store in memory (in the sequence state) and what to "forget". At the time of writing the most used approach is the _Long short-term memory (LSTM)_. While internally more complex due to the presence of the gates and of several different states (_hidden_ and _visible_ in LSTM), LSTM networks are operationally used exactly in the same ways as the RNN networks described above. + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/04_-_NN_-_Neural_Networks/0402_-_Implementation_of_neural_networks_workflows.jl b/lessonsSources/04_-_NN_-_Neural_Networks/0402_-_Implementation_of_neural_networks_workflows.jl index cfdf2f9..7e0318c 100644 --- a/lessonsSources/04_-_NN_-_Neural_Networks/0402_-_Implementation_of_neural_networks_workflows.jl +++ b/lessonsSources/04_-_NN_-_Neural_Networks/0402_-_Implementation_of_neural_networks_workflows.jl @@ -1,11 +1,11 @@ -################################################################################ -### Introduction to Scientific Programming and Machine Learning with Julia ### -### ### -### Run each script on a new clean Julia session ### -### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### -### Licence (apply to all material of the course: scripts, videos, quizes,..)### -### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### -################################################################################ +################################################################################ #src +### Introduction to Scientific Programming and Machine Learning with Julia ### #src +### ### #src +### Run each script on a new clean Julia session ### #src +### GitHub: https://github.com/sylvaticus/IntroSPMLJuliaCourse ### #src +### Licence (apply to all material of the course: scripts, videos, quizes,..)### #src +### Creative Commons By Attribution (CC BY 4.0), Antonello Lobianco ### #src +################################################################################ #src # # 0402 - Implementation of Neural network workflows @@ -55,7 +55,7 @@ testAccuracy = accuracy(ytest,yΜ‚test) # #### Specifying all options -# Creating a custim callback function to receive info during training... +# Creating a custom callback function to receive info during training... function myOwnTrainingInfo(nn,xbatch,ybatch,x,y;n,n_batches,epochs,epochs_ran,verbosity,n_epoch,n_batch) if verbosity == NONE return false # doesn't stop the training @@ -92,7 +92,6 @@ testAccuracy = accuracy(yΜ‚test,ytest) iris = readdlm(joinpath(dirname(Base.find_package("BetaML")),"..","test","data","iris.csv"),',',skipstart=1) iris = iris[shuffle(axes(iris, 1)), :] # Shuffle the records, as they aren't by default x = convert(Array{Float64,2}, iris[:,1:4]) -#y = map(x->Dict("setosa" => 1, "versicolor" => 2, "virginica" =>3)[x],iris[:, 5]) # Convert the target column to numbers ystring = String.(iris[:, 5]) iemod = OrdinalEncoder() y = fit!(iemod,ystring) @@ -220,4 +219,4 @@ res = info(cm) heatmap(string.(res["categories"]),string.(res["categories"]),res["normalised_scores"],seriescolor=cgrad([:white,:blue]),xlabel="Predicted",ylabel="Actual", title="Confusion Matrix (normalised scores)") savefig("cm_digits.svg") -# ![](cm_digits.svg) +# ![](cm_digits.svg) \ No newline at end of file diff --git a/lessonsSources/04_-_NN_-_Neural_Networks/0402x_EXERCISE-4.1.md b/lessonsSources/04_-_NN_-_Neural_Networks/0402x_EXERCISE-4.1.md index 53f2f86..8ec61f6 100644 --- a/lessonsSources/04_-_NN_-_Neural_Networks/0402x_EXERCISE-4.1.md +++ b/lessonsSources/04_-_NN_-_Neural_Networks/0402x_EXERCISE-4.1.md @@ -263,3 +263,219 @@ scatter(ytest,yΜ‚test,xlabel="true values", ylabel="estimated values", legend=no ```@raw html ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/04_-_NN_-_Neural_Networks/0402x_EXERCISE-4.2.md b/lessonsSources/04_-_NN_-_Neural_Networks/0402x_EXERCISE-4.2.md index 53721d5..cecab2f 100644 --- a/lessonsSources/04_-_NN_-_Neural_Networks/0402x_EXERCISE-4.2.md +++ b/lessonsSources/04_-_NN_-_Neural_Networks/0402x_EXERCISE-4.2.md @@ -279,4 +279,219 @@ plot(info(mynn)["loss_per_epoch"]) ``` ```@raw html -``` \ No newline at end of file +``` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/05_-_DT_-_Decision_trees_based_algorithms/0501_-_Decision_trees_based_algorithms.md b/lessonsSources/05_-_DT_-_Decision_trees_based_algorithms/0501_-_Decision_trees_based_algorithms.md index 219ca50..fb5d1af 100644 --- a/lessonsSources/05_-_DT_-_Decision_trees_based_algorithms/0501_-_Decision_trees_based_algorithms.md +++ b/lessonsSources/05_-_DT_-_Decision_trees_based_algorithms/0501_-_Decision_trees_based_algorithms.md @@ -34,4 +34,399 @@ While RF generalise well, still a few hyperparameters are provided in order to i - `min_gain`: The minimum information gain to allow for a node's partition [def: `0`] - `min_records`: The minimum number of records a node must holds to consider for a partition of it [def: `2`] - `max_features`: The maximum number of (random) features to consider at each partitioning [def: `√D`,] -- `splitting_criterion`: Either `gini`, `entropy` or `variance` \ No newline at end of file +- `splitting_criterion`: Either `gini`, `entropy` or `variance` +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/lessonsSources/05_-_DT_-_Decision_trees_based_algorithms/0502x_EXERCISE-5.1.md b/lessonsSources/05_-_DT_-_Decision_trees_based_algorithms/0502x_EXERCISE-5.1.md index 3da77bd..616fef1 100644 --- a/lessonsSources/05_-_DT_-_Decision_trees_based_algorithms/0502x_EXERCISE-5.1.md +++ b/lessonsSources/05_-_DT_-_Decision_trees_based_algorithms/0502x_EXERCISE-5.1.md @@ -423,3 +423,399 @@ testAccuracy = accuracy(ytest,Ε·test) ```@raw html ``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` + +--------- +```@raw html +
+ +``` +```@raw html +
+``` + +--------- +```@raw html + +``` +```@raw html + +``` +```@raw html + + +``` diff --git a/makedoc.jl b/makedoc.jl index ed48268..242a6fd 100644 --- a/makedoc.jl +++ b/makedoc.jl @@ -290,6 +290,7 @@ makedocs(sitename="SPMLJ", assets = ["assets/custom.css"], ), #strict = true, + warnonly = true, #doctest = false source = "lessonsSources", # Attention here !!!!!!!!!!! build = "buildedDoc",