// workaround to suppress verbose output of variables
implicit def dont_show_stuff[T] = new pprint.PPrinter[T] {
def render0(t: T, c: pprint.Config) : Iterator[String] = List("[hidden]").toIterator
}
import $ivy.`com.picnicml::doddle-model:0.0.0-SNAPSHOT`
import $ivy.`org.plotly-scala::plotly-jupyter-scala:0.3.0`
import scala.util.Random
import breeze.linalg._
import com.picnicml.doddlemodel.data.{loadBreastCancerDataset, splitDataset, shuffleDataset}
import com.picnicml.doddlemodel.linear.LogisticRegression
import com.picnicml.doddlemodel.metrics.RankingMetrics.rocCurve
import com.picnicml.doddlemodel.metrics.auc
implicit val rand: Random = new Random(0)
val (x, y) = (shuffleDataset _).tupled(loadBreastCancerDataset)
val (xTr, yTr, xTe, yTe) = splitDataset(x, y, proportionTrain = 0.75)
val model = LogisticRegression().fit(xTr, yTr)
val roc = rocCurve(yTe, model.predictProba(xTe)(::, 0))
println(s"test set AUC: ${auc(yTe, model.predictProba(xTe)(::, 0))}")
import plotly._
import plotly.element._
import plotly.layout._
import plotly.JupyterScala._
plotly.JupyterScala.init()
val xs = roc.fpr.toScalaVector
val ys = roc.tpr.toScalaVector
val scatter = Scatter(xs, ys, marker = Marker(color = Color.RGB(0, 102, 255)), fill = Fill.ToZeroY)
val layout = Layout(height = 650, width = 650)
Seq(scatter).plot(layout, "")