-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmllib.rb
More file actions
81 lines (68 loc) · 3.22 KB
/
mllib.rb
File metadata and controls
81 lines (68 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
module Spark
# 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.
module Mllib
extend Spark::Library
# Base classes
autoload_without_import :VectorBase, 'spark/mllib/vector'
autoload_without_import :MatrixBase, 'spark/mllib/matrix'
autoload_without_import :RegressionMethodBase, 'spark/mllib/regression/common'
autoload_without_import :ClassificationMethodBase, 'spark/mllib/classification/common'
# Linear algebra
autoload :Vectors, 'spark/mllib/vector'
autoload :DenseVector, 'spark/mllib/vector'
autoload :SparseVector, 'spark/mllib/vector'
autoload :Matrices, 'spark/mllib/matrix'
autoload :DenseMatrix, 'spark/mllib/matrix'
autoload :SparseMatrix, 'spark/mllib/matrix'
# Regression
autoload :LabeledPoint, 'spark/mllib/regression/labeled_point'
autoload :RegressionModel, 'spark/mllib/regression/common'
autoload :LinearRegressionModel, 'spark/mllib/regression/linear'
autoload :LinearRegressionWithSGD, 'spark/mllib/regression/linear'
autoload :LassoModel, 'spark/mllib/regression/lasso'
autoload :LassoWithSGD, 'spark/mllib/regression/lasso'
autoload :RidgeRegressionModel, 'spark/mllib/regression/ridge'
autoload :RidgeRegressionWithSGD, 'spark/mllib/regression/ridge'
# Classification
autoload :ClassificationModel, 'spark/mllib/classification/common'
autoload :LogisticRegressionWithSGD, 'spark/mllib/classification/logistic_regression'
autoload :LogisticRegressionWithLBFGS, 'spark/mllib/classification/logistic_regression'
autoload :SVMModel, 'spark/mllib/classification/svm'
autoload :SVMWithSGD, 'spark/mllib/classification/svm'
autoload :NaiveBayesModel, 'spark/mllib/classification/naive_bayes'
autoload :NaiveBayes, 'spark/mllib/classification/naive_bayes'
# Clustering
autoload :KMeans, 'spark/mllib/clustering/kmeans'
autoload :KMeansModel, 'spark/mllib/clustering/kmeans'
autoload :GaussianMixture, 'spark/mllib/clustering/gaussian_mixture'
autoload :GaussianMixtureModel, 'spark/mllib/clustering/gaussian_mixture'
# Stat
autoload :MultivariateGaussian, 'spark/mllib/stat/distribution'
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
def self.narray?
Gem::Specification::find_all_by_name('narray').any?
end
def self.mdarray?
Gem::Specification::find_all_by_name('mdarray').any?
end
end
end
Spark::Mllib.prepare