Last active
August 14, 2018 17:31
-
-
Save George3d6/63553c05819db8db4f100b2494cb0f68 to your computer and use it in GitHub Desktop.
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
Pkg.add("Knet") | |
Pkg.add("Plots") | |
Pkg.add("GR") | |
function julia(x, y, width, height, c) | |
z = ((y/width)*2.7 - 1.3) + ((x/height)*4.5 - 2.5)im | |
for i = 1:254 | |
z = z^2 + c | |
if abs(z) >= 4 | |
return Float32(i) | |
end | |
end | |
return Float32(255) | |
end | |
julia_set(height, width, c) = [julia(x, y, width, height, c) for x = 1:height, y = 1:width] | |
function get_training_data(n,size) | |
data = [] | |
for i=1:n | |
c = 1.2e^( (rand()/10 + (n/14)*π)*im) | |
push!(data, julia_set(size, size, c)) | |
end | |
cat(4, map(x -> cat(3,x),data)...) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment