Module: Spark::Mllib

Defined in:
lib/spark/mllib.rb,
lib/spark/mllib/matrix.rb,
lib/spark/mllib/matrix.rb,
lib/spark/mllib/matrix.rb,
lib/spark/mllib/matrix.rb,
lib/spark/mllib/vector.rb,
lib/spark/mllib/vector.rb,
lib/spark/mllib/vector.rb,
lib/spark/mllib/vector.rb,
lib/spark/mllib/regression/lasso.rb,
lib/spark/mllib/regression/ridge.rb,
lib/spark/mllib/clustering/kmeans.rb,
lib/spark/mllib/clustering/kmeans.rb,
lib/spark/mllib/regression/common.rb,
lib/spark/mllib/regression/common.rb,
lib/spark/mllib/regression/linear.rb,
lib/spark/mllib/classification/svm.rb,
lib/spark/mllib/classification/svm.rb,
lib/spark/mllib/classification/common.rb,
lib/spark/mllib/classification/common.rb,
lib/spark/mllib/regression/labeled_point.rb,
lib/spark/mllib/classification/naive_bayes.rb,
lib/spark/mllib/classification/naive_bayes.rb,
lib/spark/mllib/ruby_matrix/matrix_adapter.rb,
lib/spark/mllib/ruby_matrix/vector_adapter.rb,
lib/spark/mllib/clustering/gaussian_mixture.rb,
lib/spark/mllib/clustering/gaussian_mixture.rb,
lib/spark/mllib/classification/logistic_regression.rb,
lib/spark/mllib/classification/logistic_regression.rb,
lib/spark/mllib/classification/logistic_regression.rb

Overview

MLlib is Spark’s scalable machine learning library consisting of common learning algorithms and utilities, including classification, regression, clustering, collaborative filtering, dimensionality reduction, as well as underlying optimization primitives.

Defined Under Namespace

Modules: Matrices, Vectors Classes: ClassificationMethodBase, ClassificationModel, DenseMatrix, DenseVector, GaussianMixture, GaussianMixtureModel, KMeans, KMeansModel, LabeledPoint, LassoModel, LassoWithSGD, LinearRegressionModel, LinearRegressionWithSGD, LogisticRegressionModel, LogisticRegressionWithLBFGS, LogisticRegressionWithSGD, MatrixAdapter, MatrixBase, NaiveBayes, NaiveBayesModel, RegressionMethodBase, RegressionModel, RidgeRegressionModel, RidgeRegressionWithSGD, SVMModel, SVMWithSGD, SparseMatrix, SparseVector, VectorAdapter, VectorBase

Class Method Summary collapse

Class Method Details

.autoload(klass, location, import = true) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/spark/mllib.rb', line 7

def self.autoload(klass, location, import=true)
  if import
    @for_importing ||= []
    @for_importing << klass
  end

  super(klass, location)
end

.autoload_without_import(klass, location) ⇒ Object



16
17
18
# File 'lib/spark/mllib.rb', line 16

def self.autoload_without_import(klass, location)
  autoload(klass, location, false)
end

.import(to = Object) ⇒ Object



83
84
85
86
87
88
# File 'lib/spark/mllib.rb', line 83

def self.import(to=Object)
  @for_importing.each do |klass|
    to.const_set(klass, const_get(klass))
  end
  nil
end

.mdarray?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/spark/mllib.rb', line 94

def self.mdarray?
  Gem::Specification::find_all_by_name('mdarray').any?
end

.narray?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/spark/mllib.rb', line 90

def self.narray?
  Gem::Specification::find_all_by_name('narray').any?
end

.prepareObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/spark/mllib.rb', line 62

def self.prepare
  return if @prepared

  # if narray?
  #   require 'spark/mllib/narray/vector'
  #   require 'spark/mllib/narray/matrix'
  # elsif mdarray?
  #   require 'spark/mllib/mdarray/vector'
  #   require 'spark/mllib/mdarray/matrix'
  # else
  #   require 'spark/mllib/matrix/vector'
  #   require 'spark/mllib/matrix/matrix'
  # end

  require 'spark/mllib/ruby_matrix/vector_adapter'
  require 'spark/mllib/ruby_matrix/matrix_adapter'

  @prepared = true
  nil
end