Unresolved imports in 'Smile' machine learning library

143 Views Asked by At

The following import does not resolve.

import smile.data.{Attribute, AttributeDataset, NumericAttribute}

Any idea on this if those attributes were removed from new Smile version 3.0.0 ?

I am using Scala 2.13.10.

How to translate the following code to Smile v3.0.0 ?

import smile.clustering.KMeans
import smile.data.{AttributeDataset, NumericAttribute}
import smile.read
import smile.write

// Load the data into a Smile AttributeDataset
val data: AttributeDataset = read.csv("data.csv", header = true)

// Split the data into two equal parts
val (data1, data2) = data.split(0.5)

// Train a k-means clustering model on the first part of the data
val model1 = KMeans.fit(data1.x(), 3)

// Train another k-means clustering model on the second part of the data
val model2 = KMeans.fit(data2.x(), 3)
1

There are 1 best solutions below

3
On

The classes smile.data.{Attribute, AttributeDataset, NumericAttribute} existed till Smile 1.5.3 (Scala 2.10.x-2.12.x)

https://mvnrepository.com/artifact/com.github.haifengl/smile-scala

They were removed in Smile 2.0.0 (Nov 22, 2019)

https://github.com/haifengl/smile/commit/07c5d2507d6ee8bd1dd68202fdbb323dada91a2f (StructType seems to replace Attribute[])

https://github.com/haifengl/smile/releases/tag/v2.0.0

  • Fully redesigned API. It is leaner, simpler and even more friendly.