GithubHelp home page GithubHelp logo

rclusterrank's Introduction

##README

○r_script_clus.Rの使い方

1.スクリプトファイルをローカル環境に置く

作業フォルダに該当スクリプトを置く。作業フォルダは、getwd()で確認可能。任意の場所に置いてから、setwd()関数でそのフォルダを指定しても良い。

2.スクリプトの適用

R上で source("r_script_clus.R")の実行

3.スクリプトの実行

スクリプトには、cls.rank関数が定義されており、データ(教師無し)とクラスタ数を指定して呼び出す。例えば、cls.rank(データ,5)と呼び出す。

クラスタ数は、デフォルト値=3を指定しているため、デフォルトで良ければ、別途指定する必要はない。 戻り値は、各クラスタの重心に近いデータポイントを5つまで(5は固定)表示する。 下記は、irisデータをクラスタ=3で、cls.rank関数を呼び出した結果である。 (種別は無し)に、該当クラスタ(cls)とクラスタの中心からの距離(dist)が追加されたデータが表示される。 下は距離の昇順に並んでいる。

				Sepal.Length Sepal.Width Petal.Length Petal.Width cls       dist
		1           5.0         3.4          1.5         0.2         1         0.06618157
		2           5.1         3.4          1.5         0.2         1         0.11480418
		3           5.1         3.5          1.4         0.2         1         0.14135063
		4           5.1         3.5          1.4         0.3         1         0.14415270
		5           5.0         3.3          1.4         0.2         1         0.14959947
		6           6.0         2.9          4.5         1.5         2         0.21993519
		7           5.7         2.8          4.5         1.3         2         0.26937898
		8           5.9         3.0          4.2         1.5         2         0.32426175
		9           5.7         2.9          4.2         1.3         2         0.34498790
		10          6.2         2.9          4.3         1.3         2         0.37241653
		11          6.8         3.0          5.5         2.1         3         0.25958095
		12          6.9         3.2          5.7         2.3         3         0.26952816
		13          6.7         3.3          5.7         2.1         3         0.27627819
		14          7.1         3.0          5.9         2.1         3         0.30610139
		15          6.8         3.2          5.9         2.3         3         0.30952112

rclusterrank's People

Contributors

yuukimy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.