-    df <- df[,w_pred:=x]
-    df <- df[sample(1:N,(1-prediction_accuracy)*N),w_pred:=(w_pred-1)**2]
-    w <- predict(glm(x ~ w_pred,data=df,family=binomial(link='logit')),type='response')
-    df <- df[,':='(w=w, w_pred = w_pred)]
+    ## how can you make a model with a specific accuracy?
+    w0 =(1-x)**2 + (-1)**(1-x) * prediction_accuracy
+
+    ## how can you make a model with a specific accuracy, with a continuous latent variable.
+    # now it makes the same amount of mistake to each point, probably
+    # add mean0 noise to the odds.
+    
+    w.noisey.odds = rlogis(N,qlogis(w0))
+    df[,w := plogis(w.noisey.odds)]
+    df[,w_pred:=as.integer(w > 0.5)]
+    (mean(df$x==df$w_pred))