This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Object types and fields | |
struct Character | |
name::String | |
appearsIn::EpisodeArray | |
end | |
# Arguments | |
mutable struct Starship |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/Algocircle/Cascadia.jl#webscraping-example | |
using Cascadia | |
using Gumbo | |
using HTTP | |
# using Requests (deprecated) | |
r = HTTP.get("http://stackoverflow.com/questions/tagged/julia-lang") | |
h = parsehtml(String(r.body)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C----------------------------------------------------------------------- | |
SUBROUTINE GTD7(IYD,SEC,ALT,GLAT,GLONG,STL,F107A,F107,AP,MASS,D,T) | |
C | |
C NRLMSISE-00 | |
C ----------- | |
C Neutral Atmosphere Empirical Model from the surface to lower | |
C exosphere | |
C | |
C NEW FEATURES: | |
C *Extensive satellite drag database used in model generation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> using Flux, Flux.Data.MNIST | |
julia> using Flux: onehotbatch, argmax, crossentropy, throttle | |
julia> using Base.Iterators: repeated | |
julia> # using CuArrays | |
# Classify MNIST digits with a simple multi-layer-perceptron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> Pkg.add("MAT") | |
INFO: Cloning cache of Blosc from https://github.com/stevengj/Blosc.jl.git | |
INFO: Cloning cache of BufferedStreams from https://github.com/BioJulia/BufferedStreams.jl.git | |
INFO: Cloning cache of CMakeWrapper from https://github.com/rdeits/CMakeWrapper.jl.git | |
INFO: Cloning cache of HDF5 from https://github.com/JuliaIO/HDF5.jl.git | |
INFO: Cloning cache of Libz from https://github.com/BioJulia/Libz.jl.git | |
INFO: Cloning cache of MAT from https://github.com/JuliaIO/MAT.jl.git | |
INFO: Installing Blosc v0.5.0 | |
INFO: Installing BufferedStreams v0.4.0 | |
INFO: Installing CMakeWrapper v0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logit mode, v0.3 | |
using CSV, Plots; pyplot(); | |
data = CSV.read("/Users/kevinliu/Documents/machine-learning-ex2/ex2/ex2data1.txt", datarow=1) | |
X = hcat(ones(100,1), Matrix(data[:, [1,2]])) | |
y = Vector(data[:, 3]) | |
# Sigmoid function | |
function sigmoid(z) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logit model, v0.2 | |
using CSV, Plots; pyplot(); | |
data = CSV.read("/Users/kevinliu/Documents/machine-learning-ex2/ex2/ex2data1.txt", datarow=1) | |
X = hcat(ones(100,1), Matrix(data[:, [1,2]])) | |
y = Vector(data[:, 3]) | |
# Sigmoid function | |
function sigmoid(z) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Visualize the data | |
using CSV, Plots; pyplot(); | |
data = CSV.read("/Users/kevinliu/Documents/machine-learning-ex2/ex2/ex2data1.txt", datarow=1) | |
X = data[:, [1,2]]; y = data[:, 3]; | |
pos = find(y); neg = find(iszero, y); # or neg = find(t -> t == 0, y); | |
scatter(xaxis=("exam 1 score", (30,100), 30:10:100)) | |
scatter!(yaxis=("exam 2 score", (30,100), 30:10:100)) | |
scatter!(X[pos, 1], X[pos, 2], markershape=:+, label="admitted") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Linear regression | |
# part 3b: plotting linear fit | |
using Plots, CSV | |
data = CSV.read("/Users/kevinliu/Downloads/machine-learning-ex1/ex1/ex1data1.txt", datarow=1) # or data = rand(97,2) | |
m = length(data[:, 2]) | |
X = hcat(ones(m, 1), data[:, 1]); | |
y = data[:, 2] | |
#thetasA = [-4.090664703327588; -2.386107508525324]; # incorrect when compared to scatter() | |
thetasB = [0.4559997241594341; 2.786203914586563]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Linear regression | |
# part 1: basic function, A = eye(5), trivial | |
# part 2: plotting | |
julia> using CSV | |
julia> data = CSV.read("/Users/kevinliu/Downloads/machine-learning-ex1/ex1/ex1data1.txt", datarow=1) | |
97×2 DataFrames.DataFrame | |
│ Row │ Column1 │ Column2 │ |
NewerOlder