K-means clustering on WebLog Data, for 2-Dimenshional input

K-means clustering on WebLog Data, for 2-Dimenshional input

The following is a JSP code for K-MEANS CLUSTERING .... My proect , titled "Pattern Analysis of Web Usage for System Improvement", involves the web log info from a database and then considering the attributes IP address and WEBPAGES,IN THE FORM OF NUMBERS(X,Y) for K-MEANS CLUSTERING... the output of this is used for WEB CACHE REPLACEMENT.. please let me knw,if the following code of K-MEANS CLUSTERING in JSP is proper and will take 2 dimenshional input(ip,webpages)... i m having hard time in converting ip and webpages into number for K-MEANS CLUSTERING...please reply.

<html>
<head>
<script type="text/javascript">

function kmeans( arrayToProcess, Clusters )
{

  var Groups = new Array();
  var Centroids = new Array();
  var oldCentroids = new Array();
  var changed = false;

  // order the input array
  arrayToProcess.sort(function(a,b){return a - b})  

  // initialise group arrays
  for( initGroups=0; initGroups < Clusters; initGroups++ )
  {

    Groups[initGroups] = new Array();

  }  

  // pick initial centroids

  initialCentroids=Math.round( arrayToProcess.length/(Clusters+1) );  

  for( i=0; i<Clusters; i++ )
  {

    Centroids[i]=arrayToProcess[ (initialCentroids*(i+1)) ];

  }

  do
  {

    for( j=0; j<Clusters; j++ )
    {

      Groups[j] = [];

    }

    changed=false;

    for( i=0; i<arrayToProcess.length; i++ )
    {

      Distance=-1;
      oldDistance=-1

      for( j=0; j<Clusters; j++ )
      {

        distance = Math.abs( Centroids[j]-arrayToProcess[i] );  

        if ( oldDistance==-1 )
        {

           oldDistance = distance;
           newGroup = j;

        }
        else if ( distance <= oldDistance )
        {

            newGroup=j;
            oldDistance = distance;

        }

      } 

      Groups[newGroup].push( arrayToProcess[i] );     

    }

    oldCentroids=Centroids;

    for ( j=0; j<Clusters; j++ )
    {

      total=0;
      newCentroid=0;

      for( i=0; i<Groups[j].length; i++ )
      {

        total+=Groups[j][i];

      } 

      newCentroid=total/Groups[newGroup].length;  

      Centroids[j]=newCentroid;

    }

    for( j=0; j<Clusters; j++ )
    {

      if ( Centroids[j]!=oldCentroids[j] )
      {

        changed=true;

      }

    }

  }
  while( changed==true );

  return Groups;
}


    </script>
</head>
<html>
View Answers









Related Tutorials/Questions & Answers:
K-means clustering on WebLog Data, for 2-Dimenshional input
K-means clustering on WebLog Data, for 2-Dimenshional input  The following is a JSP code for K-MEANS CLUSTERING .... My proect , titled "Pattern... OF NUMBERS(X,Y) for K-MEANS CLUSTERING... the output of this is used for WEB CACHE
ModuleNotFoundError: No module named 'k-means-constrained'
ModuleNotFoundError: No module named 'k-means-constrained'  Hi, My... named 'k-means-constrained' How to remove the ModuleNotFoundError: No module named 'k-means-constrained' error? Thanks   Hi
Advertisements
ModuleNotFoundError: No module named 'k-means-plus-plus'
ModuleNotFoundError: No module named 'k-means-plus-plus'  Hi, My... named 'k-means-plus-plus' How to remove the ModuleNotFoundError: No module named 'k-means-plus-plus' error? Thanks   Hi, In your
Data input & output Stream
Data input & output Stream  Explain Data Input Stream and Data Output Stream Class.   DataInputStream and DataOutputStream A data input stream lets an application read primitive Java data types from an underlying input
ModuleNotFoundError: No module named 'weblog'
ModuleNotFoundError: No module named 'weblog'  Hi, My Python... 'weblog' How to remove the ModuleNotFoundError: No module named 'weblog'... to install padas library. You can install weblog python with following command
Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening the program. I am developing a college library management system, i would like
Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening the program. I am developing a college library management system, i would like
Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening the program. I am developing a college library management system, i would like
Managing Multiple User Input Data in an Array (or ArrayList)
Managing Multiple User Input Data in an Array (or ArrayList)  Hey... record alphabetically (2) If user chooses choice1, the input data is stored in an ARRAY (or ARRAYLIST) until the user chooses to stop inputting data. Kindly
ModuleNotFoundError: No module named 'django-weblog'
ModuleNotFoundError: No module named 'django-weblog'  Hi, My... 'django-weblog' How to remove the ModuleNotFoundError: No module named 'django-weblog' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-weblog'
ModuleNotFoundError: No module named 'django-weblog'  Hi, My... 'django-weblog' How to remove the ModuleNotFoundError: No module named 'django-weblog' error? Thanks   Hi, In your python
Clustering
Clustering  Plz let me know abt Clustering in Java with an example
input
input  a java program that will exchange the last names of two students that were input by a user
coursera clustering
coursera clustering  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: coursera clustering... courses in Machine Learning, Artificial Intelligence and Data Science
escaping user input in php
escaping user input in php  Is it possible to escape the user input while submitting data into database in PHP
input box
input box  give me the code of input box in core java
input box
input box  give me the code of input box in core java
input output
; Introduction The Java I/O means Java Input/Output and is a part... data types from the input stream in a machine format.... UTFDataFormatException A molformed UTF-8 has been read in a data input stream
Array and input
to input one of the above numbers then i want to print the array without the number user input. how will i do tht
Java Command Line Input
this code you will find the output as Please Input A Number 2 data is- 2...Java Command Line Input  How to get input from command line in java ?   Hi please Find the code for inputting data from the command line
keyboard input
keyboard input  how do I use JOptionPane to accept keyboard input? I know how to import but not specific command on input line   import javax.swing.*; class JOPtionPaneExample { public static void main(String
input output
input output  java program using fileinputstream and fileoutputstream   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args
input output
input output  java program using fileinputstream and fileoutputstream   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args
Version of com.brettonw>clustering dependency
List of Version of com.brettonw>clustering dependency
Take input in batch file
Take input in batch file  How to take input in batch file? Thanks   Hi, You can use the following line of code in your batch file: set /p myfile=Enter file name: In the above code myfile variable will hold the data
Input - Output String Functions
data from a user (text field, text area) since it is not secure to receive a string data and input them directly into your database. Some special characters... Input - Output String Functions      
input - Java Beginners
to input the data from the command prompt. Try the following code to input name... me soon.  Hi Friend, There are lot of ways to input data.You can use...:"); Scanner input=new Scanner(System.in); String name=input.nextLine
Java Input/Output Examples
and interfaces to handle the system input & output through data streams...Java Input/Output Examples In this tutorial you will learn about how the Inputs and outputs are managed in java. To understand the Java Input & Output
store input and display previous input as well current input. in jsp
store input and display previous input as well current input. in jsp  Hi Friend, In this JSP program i want display the previous input as well current inputs also. currently only current input i am able to display whenever i
How to create an input box?
How to create an input box?  How to create an input box
Version of geronimo>geronimo-clustering dependency
List of Version of geronimo>geronimo-clustering dependency
Version of com.apporiented>hierarchical-clustering dependency
List of Version of com.apporiented>hierarchical-clustering dependency
HTML5 input examples, Introduction and implementation of input tag.
HTML5 input examples, Introduction and implementation of input tag. Introduction:In this tutorial, you will see the use of input tag. The input tag is a input field in a form. In which user can insert data, and the type of data
ModuleNotFoundError: No module named 'cec-clustering'
ModuleNotFoundError: No module named 'cec-clustering'  Hi, My... named 'cec-clustering' How to remove the ModuleNotFoundError: No module named 'cec-clustering' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'clustering-jhk'
ModuleNotFoundError: No module named 'clustering-jhk'  Hi, My... named 'clustering-jhk' How to remove the ModuleNotFoundError: No module named 'clustering-jhk' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'clustering-jhk'
ModuleNotFoundError: No module named 'clustering-jhk'  Hi, My... named 'clustering-jhk' How to remove the ModuleNotFoundError: No module named 'clustering-jhk' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'clustering-jhk'
ModuleNotFoundError: No module named 'clustering-jhk'  Hi, My... named 'clustering-jhk' How to remove the ModuleNotFoundError: No module named 'clustering-jhk' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'clustering-jhk'
ModuleNotFoundError: No module named 'clustering-jhk'  Hi, My... named 'clustering-jhk' How to remove the ModuleNotFoundError: No module named 'clustering-jhk' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'clustering-jhk'
ModuleNotFoundError: No module named 'clustering-jhk'  Hi, My... named 'clustering-jhk' How to remove the ModuleNotFoundError: No module named 'clustering-jhk' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'markov-clustering'
ModuleNotFoundError: No module named 'markov-clustering'  Hi, My... named 'markov-clustering' How to remove the ModuleNotFoundError: No module named 'markov-clustering' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'mst_clustering'
ModuleNotFoundError: No module named 'mst_clustering'  Hi, My... named 'mst_clustering' How to remove the ModuleNotFoundError: No module named 'mst_clustering' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'page_clustering'
ModuleNotFoundError: No module named 'page_clustering'  Hi, My... named 'page_clustering' How to remove the ModuleNotFoundError: No module named 'page_clustering' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'phovea_clustering'
ModuleNotFoundError: No module named 'phovea_clustering'  Hi, My... named 'phovea_clustering' How to remove the ModuleNotFoundError: No module named 'phovea_clustering' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'poi-clustering'
ModuleNotFoundError: No module named 'poi-clustering'  Hi, My... named 'poi-clustering' How to remove the ModuleNotFoundError: No module named 'poi-clustering' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'poi-clustering'
ModuleNotFoundError: No module named 'poi-clustering'  Hi, My... named 'poi-clustering' How to remove the ModuleNotFoundError: No module named 'poi-clustering' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pyclics-clustering'
ModuleNotFoundError: No module named 'pyclics-clustering'  Hi, My... named 'pyclics-clustering' How to remove the ModuleNotFoundError: No module named 'pyclics-clustering' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'pyclics-clustering'
ModuleNotFoundError: No module named 'pyclics-clustering'  Hi, My... named 'pyclics-clustering' How to remove the ModuleNotFoundError: No module named 'pyclics-clustering' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'silicon-clustering'
ModuleNotFoundError: No module named 'silicon-clustering'  Hi, My... named 'silicon-clustering' How to remove the ModuleNotFoundError: No module named 'silicon-clustering' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'spin-clustering'
ModuleNotFoundError: No module named 'spin-clustering'  Hi, My... named 'spin-clustering' How to remove the ModuleNotFoundError: No module named 'spin-clustering' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'topological-clustering'
ModuleNotFoundError: No module named 'topological-clustering'  Hi...: No module named 'topological-clustering' How to remove the ModuleNotFoundError: No module named 'topological-clustering' error? Thanks   Hi

Ads