私はカーネルK-Means(別名https://en.wikipedia.org/wiki/K-means_clusteringですが、トリックを実行するためのコード)を作成しています。私はデータを生成する必要があり、最初の単純なジェネレータとして、私はガウス混合モデルを実装しようとしました。ここに私のコードです:Scala-Breezeを使用したSBTコンパイラのクラッシュ
Error in Scala compiler: assertion failed: List(method apply$mcI$sp, method apply$mcI$sp)
SBT builder crashed while compiling. The error message is 'assertion failed: List(method apply$mcI$sp, method apply$mcI$sp)'. Check Error Log for details.
:私は私のコードをコンパイルしようとすると
package p02kmeans
import breeze.linalg._
import breeze.stats.distributions._
/**
* First data generation is simple, gaussian mixture model.
*/
object Data {
class GaussianClassParam (
val mean: Double,
val sd: Double)
/**
* @param proportion marginal probability for each label
* @param param param[j][k] returns the GaussianClassParam for the k class of the j variable
* @param nObs number of observations to be generated
* @result DenseMatrix_ij where i is the observation index and j is the variable number
*/
def gaussianMixture(
proportion: DenseVector[Double],
param: Vector[Vector[GaussianClassParam]],
nObs: Int)
: DenseMatrix[Double] = {
val nVar = param.size
val multiSampler = Multinomial(proportion) // sampler for the latent class
val varSamplerVec = param.map(v => v.map(c => Gaussian(c.mean, c.sd)))
val zi = DenseVector.fill[Int](nObs)(multiSampler.sample)
val data = DenseMatrix.tabulate[Double](nObs, nVar)((i, j) => varSamplerVec(j)(zi(i)).sample)
return data
}
}
は(私は、Windows 10上でのScala-IDEとSBTの日食を使用して)私は2つのエラーが発生します
このエラーは、次の行によってトリガーされます。
val data = DenseMatrix.tabulate[Double](nObs, nVar)((i, j) => varSamplerVec(j)(zi(i)).sample)
として消える:
val data = DenseMatrix.tabulate[Double](nObs, nVar)((i, j) => 12.0)
は、あなたは私がこれをデバッグに役立つだろうか?
マイSBT構成:
name := "Sernel"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.scalanlp" %% "breeze" % "0.13.1",
"org.scalanlp" %% "breeze-natives" % "0.13.1",
"org.scalanlp" %% "breeze-viz" % "0.13.1"
)
私はOSXのセットアップで同じエラーを持っています。
エラーを再現したい場合は、パッケージ全体をテストしたい場合は、Github:https://github.com/vkubicki/sernelのコードを入手できます。
これはコンパイラのバグのようです(私はBreezeがそれらを使用しているため、scalaマクロであると思います)。あなたはプロジェクトで完全なクリーンアップを試みることができます(恐らく '.ivy2'フォルダも含めて - これはあなたのMacOSとWindowsのセットアップの違いかもしれません)、またあなたのscalaを2.11.11(あるいは2.12.x)にアップデートしてください – dk14
それは、ありがとう! Eclipseで更新サイトを編集する必要があったのは、ここで提案しているScala IDEがScala 2.11.8に限られているからです。 Scala 2.12.2を出荷している最新バージョンを使用して、エラーは消えました:) – vkubicki
このコメントを回答として提案したい場合、私はそれを選択し、それは質問を閉じるでしょう:)。 – vkubicki