data
=
[[1,1],
[1,2],
[1,1],
[1000,
1000],
[500,
500]]
kmeans
=
KMeans.new(data,
:centroids
=>
2)
kmeans.inspect
#
Use
kmeans.view
to
get
hold
of
the
un-‐inspected
array
=>
[[3,
4],
[0,
1,
2]]
A shallow magnitude 2.7 earthquake aftershock was reported Monday morning four miles from Westwood, according to the U.S. Geological Survey. The temblor occurred at 7:23 a.m. Pacific time at a depth of 4.3 miles. A magnitude 4.4 earthquake was reported at 6.25 a.m. and was felt over a large swath of Southern California. According to the USGS, the epicenter of the aftershock was five miles from Beverly Hills, six miles from Santa Monica and six miles from West Hollywood. In the last 10 days, there has been one earthquake of magnitude 3.0 or greater centered nearby. This information comes from the USGS Earthquake Notification Service and this post was created by an algorithm written by the author. http://lat.ms/1lTIGqa
cardmagic/classifier 2 require
'classifier'
! b
=
Classifier::Bayes.new
'Interesting',
'Uninteresting'
b.train_interesting
"here
are
some
good
words.
I
hope
you
love
them"
b.train_uninteresting
"here
are
some
bad
words,
I
hate
you"
b.classify
"I
hate
bad
words
and
you"
#
returns
'Uninteresting'