以下导入未解析。
import smile.data.{Attribute, AttributeDataset, NumericAttribute}
如果这些属性从新的微笑版本3.0.0中删除,你对此有什么想法吗?
我使用的是Scala 2.13.10。
如何将下面的代码翻译成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)
2条答案
按热度按时间pgvzfuti1#
类
smile.data.{Attribute, AttributeDataset, NumericAttribute}
一直存在到Smile 1.5.3(Scala 2.10.x-2.12.x)https://mvnrepository.com/artifact/com.github.haifengl/smile-scala
已在Smile 2.0.0(2019年11月22日)中删除
https://github.com/haifengl/smile/commit/07c5d2507d6ee8bd1dd68202fdbb323dada91a2f(
StructType
似乎取代了Attribute[]
)https://github.com/haifengl/smile/releases/tag/v2.0.0
oymdgrw72#
好的,完成了,chatGPT做到了:)