@Throws(Exception::class) fun buildClassifier(D: Instances) { val r = Random(m_seed) if (fastaram) { networks = arrayOfNulls<ARAMNetworkfast>(numberofnetworks) } else if (sparsearam) { networks = arrayOfNulls<ARAMNetworkSparse>(numberofnetworks) } else if (sparsearamH) { networks = arrayOfNulls<ARAMNetworkSparseV>(numberofnetworks) } else if (sparsearamHT) { networks = arrayOfNulls<ARAMNetworkSparseHT>(numberofnetworks) } else { networks = arrayOfNulls<ARAMNetwork>(numberofnetworks) } numClasses = D.classIndex() if (tfastaram) { val bc: Array<BuildClassifier?> = arrayOfNulls<BuildClassifier>(numberofnetworks) for (i in 0 until numberofnetworks) { val list: MutableList<Int?> = ArrayList() for (j in 0 until D.numInstances()) { list.add(j) } Collections.shuffle(list, r) if (fastaram) { networks.get(i) = ARAMNetworkfast() } else if (sparsearam) { networks.get(i) = ARAMNetworkSparse() } else if (sparsearamH) { networks.get(i) = ARAMNetworkSparseV() } else if (sparsearamHT) { networks.get(i) = ARAMNetworkSparseHT() } else { networks.get(i) = ARAMNetwork() } networks.get(i).order = list networks.get(i).roa = roa bc[i] = BuildClassifier(networks.get(i)) bc[i].setinstances(D) bc[i].start() } for (i in 0 until numberofnetworks) { bc[i].join() networks.get(i) = bc[i].m_network networks.get(i).learningphase = false } } else { for (i in 0 until numberofnetworks) { if (fastaram) { networks.get(i) = ARAMNetworkfast() } else if (sparsearam) { networks.get(i) = ARAMNetworkSparse() } else if (sparsearamH) { networks.get(i) = ARAMNetworkSparseV() } else if (sparsearamHT) { networks.get(i) = ARAMNetworkSparseHT() } else { networks.get(i) = ARAMNetwork() } networks.get(i).roa = roa networks.get(i).buildClassifier(D) networks.get(i).learningphase = false D.randomize(r) } } dc = arrayOfNulls<DistributionCalc>(numberofnetworks) }
Generates the classifier .