Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Values.java
Package: Weka-3-2.rar [view]
Upload User: rhdiban
Upload Date: 2013-08-09
Package Size: 15085k
Code Size: 3k
Category:
Windows Develop
Development Platform:
Java
- /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
- /*
- * Values.java
- * Copyright (C) 1999
- *
- */
- package weka.classifiers.trees.m5;
- import java.io.*;
- import java.util.*;
- import weka.core.*;
- /**
- * Stores some statistics.
- * @author Yong Wang (yongwang@cs.waikato.ac.nz)
- * @version $Revision: 1.5 $
- */
- public final class Values {
- int numInstances; // number of the instances
- int missingInstances; // number of the instances with missing values
- int first; // index of the first instance
- int last; // index of the last instance
- int attr; // attribute
- double sum; // sum of the instances for attribute
- double sqrSum; // squared sum of the instances for attribute
- double va; // variance
- double sd; // standard deviation
- /**
- * Constructs an object which stores some statistics of the instances such
- * as sum, squared sum, variance, standard deviation
- * @param low the index of the first instance
- * @param high the index of the last instance
- * @param attribute the attribute
- * @param inst the instances
- */
- public Values(int low,int high,int attribute,Instances inst){
- int i,count=0;
- double value;
- numInstances = high-low+1;
- missingInstances = 0;
- first = low;
- last = high;
- attr = attribute;
- sum=0.0;
- sqrSum=0.0;
- for(i=first;i<=last;i++){
- if(inst.instance(i).isMissing(attr)==false){
- count++;
- value = inst.instance(i).value(attr);
- sum += value;
- sqrSum += value * value;
- }
- if(count >1){
- va = (sqrSum - sum * sum/count)/count;
- va = Math.abs(va);
- sd = Math.sqrt(va);
- }
- else {va = 0.0; sd = 0.0;}
- }
- }
- /**
- * Converts the stats to a string
- * @return the converted string
- */
- public final String toString(){
- StringBuffer text = new StringBuffer();
- text.append("Print statistic values of instances (" + first + "-" + last +
- "n");
- text.append(" Number of instances:t" + numInstances + "n");
- text.append(" NUmber of instances with unknowns:t" + missingInstances +
- "n");
- text.append(" Attribute:ttt:" + attr + "n");
- text.append(" Sum:ttt" + sum + "n");
- text.append(" Squared sum:tt" + sqrSum + "n");
- text.append(" Stanard Deviation:tt" + sd + "n");
- return text.toString();
- }
- }