Modified from Lecture 1’s file
using CSV, DataFrames apples = DataFrame(CSV.File(datapath("data/apples.dat"), delim='\t', normalizenames=true)) bananas = DataFrame(CSV.File(datapath("data/bananas.dat"), delim='\t', normalizenames=true)); x_apples = [ [row.red, row.green] for row in eachrow(apples)] x_bananas = [ [row.red, row.green] for row in eachrow(bananas)]; xs = [x_apples; x_bananas] # vertical stacking of the features ys = [fill(0, size(x_apples)); fill(1, size(x_bananas))]; # labels xs using Flux, Plots model = Dense(2, 1, σ) lossfun(feature, label) = Flux.mse(model(feature), label) plot(lossfun.(xs, ys)) # Array of losses for each feature-label pair.
This results in the amusing plot that seems to have a very regular spiking interspersed in two rolling fields. Any idea why this is true?