Click here to Skip to main content
15,896,118 members
Home / Discussions / Java
   

Java

 
AnswerRe: is java is pure object oriented langage Pin
Zain Ul Abidin7-Jul-14 18:41
Zain Ul Abidin7-Jul-14 18:41 
AnswerRe: is java is pure object oriented langage Pin
Neo101017-Jul-14 22:35
Neo101017-Jul-14 22:35 
AnswerRe: is java is pure object oriented langage Pin
Member 109319487-Jul-14 23:45
Member 109319487-Jul-14 23:45 
AnswerRe: is java is pure object oriented langage Pin
Tushar Guru8-Sep-14 21:41
Tushar Guru8-Sep-14 21:41 
QuestionBIRT report in java Pin
Arjun YK6-Jul-14 2:33
Arjun YK6-Jul-14 2:33 
Questionveda web services Pin
Member 109188101-Jul-14 23:51
Member 109188101-Jul-14 23:51 
AnswerRe: veda web services Pin
Richard MacCutchan2-Jul-14 5:45
mveRichard MacCutchan2-Jul-14 5:45 
QuestionNeed source code for FRECCA algorithm. Pin
Member 83982281-Jul-14 21:52
Member 83982281-Jul-14 21:52 
I tried to implement as following in java. But the code is not working.
Someone help to complete this code in java or any other language.

This is the algorithm - https://onedrive.live.com/?cid=9a23cd9d216bc283&id=9A23CD9D216BC283!192&sff=1&v=3[^]

and code is below-

Java
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.*;

public class Code {
	private static int N = 100,C = 5;
	private static double[][]  S = new double[N][N], P = new double[C][N], l = new double[C][N],PR = new double[N][C];
	private static double[] PI = new double[C];
	private static double[][][] w = new double[C][N][N];
	final static double d = 0.85;
	public Code() {
		System.out.println("Code Class");
	}
	
	public double SumOfWkjm(int m,int j){
		double ans = 0.0;
		for(int k=0;k<N;k++) ans+=w[m][j][k];
		System.out.println("SumOfWkjm: "+ans);
		return ans;
	}
	
	public double SumOfWjim(int m,int i){
		double ans = 0.0;
		for(int j=0;j<N;j++){
			ans+=w[m][j][i]*( PR[m][j]/SumOfWkjm(m, j) );
		}
		System.out.println("SumOfWjim: "+ans);
		return ans;
	}
	
	public void initialize() throws FileNotFoundException{
		System.out.println("Initialize:");
		Similarity obj = new Similarity();
		//Arrays.fill(S, 1.0);
		obj.Similaritymain();
		N = obj.sentenceCount;
		S = new double[N][N];		
		S = obj.Similaritymain();
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				System.out.print(S[i][j]+" ");
			}
			System.out.println();
		}
		//Arrays.fill(l, 1.0);
		Random randomGenerator = new Random();
		for (int i = 0; i < N; ++i){ // 3rd line in algorithm
			double sumP = 0.0;
		    for(int m=0;m<C;m++)  {
		    	int randomInt = randomGenerator.nextInt(100);
		    	P[m][i] = (double)randomInt/100.0;
		    	sumP+=P[m][i]; 
		    }
		    for(int m=0;m<C;m++)  {
		    	P[m][i] = P[m][i]/sumP;
		    }		    
		} // 10th line in algorithm 
		for(int m=0;m<C;++m){
	    	PI[m] = 1.0/C; 
	    }
		PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
		System.setOut(out);
	}
	
	public void convergence(){
		int cc = 0;
		while(cc<10){
			for(int m=0;m<C;++m){ // 16th line in algorithm
				for(int i=0;i<N;++i){
					for(int j=0;j<N;++j){
						w[m][i][j] = S[i][j]*P[m][i]*P[m][j];
						System.out.println("wmij =" + w[m][i][j]);
					}
					
				}
				
				//for(int cn=0;cn<100;++cn){
					for(int I=0;I<N;I++){
						PR[m][I] = (1-d)+d*SumOfWjim(m,I);
					}
				//}
				for(int I=0;I<N;++I) 
					l[m][I] = PR[m][I];
			}// 29th line of algorithm		
			
			for(int i=0;i<N;++i){ //31th line
				double sumPIl = 0.0;
				for(int j=0;j<C;++j){
					sumPIl += PI[j]*l[i][j];   
				}
				for(int m=0;m<C;++m) {
					P[i][m] = (PI[m]*l[i][m])/sumPIl;
				}
			}// 35th line
			// calculate new cluster membership values
			for(int m=0;m<C;m++){ //38th line
				double sums = 0.0;
				for(int i=0;i<N;i++){
					sums+=P[m][i];
				}
				PI[m] = sums/N;
			}//40th line
			cc++;
			for(int m=0;m<C;m++){
				for(int i=0;i<N;i++){
					System.out.print(P[m][i]+" ");
				}
				System.out.println();
			}
		}
	}
}

QuestionRe: Need source code for FRECCA algorithm. Pin
Richard MacCutchan2-Jul-14 5:44
mveRichard MacCutchan2-Jul-14 5:44 
AnswerRe: Need source code for FRECCA algorithm. Pin
Member 83982282-Jul-14 6:57
Member 83982282-Jul-14 6:57 
Questionhow to define multiple serivice names in single wsdl in jax-ws ri implementation? is it possible? Pin
Member 1091573730-Jun-14 20:49
Member 1091573730-Jun-14 20:49 
AnswerRe: how to define multiple serivice names in single wsdl in jax-ws ri implementation? is it possible? Pin
rajeev12413-Jul-14 20:32
professionalrajeev12413-Jul-14 20:32 
QuestionHow to determine the width for multiple Lines of Text Using TextLayout and LineBreakMeasurer Pin
f2624-Jun-14 22:26
f2624-Jun-14 22:26 
Questionretrieving past records in inventory management system Pin
krishna_m23-Jun-14 2:15
professionalkrishna_m23-Jun-14 2:15 
SuggestionRe: retrieving past records in inventory management system Pin
Richard MacCutchan25-Jun-14 15:12
mveRichard MacCutchan25-Jun-14 15:12 
QuestionNeed help on JAVA survey Pin
mohammed shihab19-Jun-14 13:42
mohammed shihab19-Jun-14 13:42 
AnswerRe: Need help on JAVA survey Pin
Richard MacCutchan19-Jun-14 22:57
mveRichard MacCutchan19-Jun-14 22:57 
QuestionRe: Need help on JAVA survey Pin
mohammed shihab20-Jun-14 0:44
mohammed shihab20-Jun-14 0:44 
AnswerRe: Need help on JAVA survey Pin
Richard MacCutchan20-Jun-14 1:25
mveRichard MacCutchan20-Jun-14 1:25 
GeneralRe: Need help on JAVA survey Pin
mohammed shihab20-Jun-14 4:40
mohammed shihab20-Jun-14 4:40 
Questionpeer to peer Pin
Member 1089097217-Jun-14 13:38
Member 1089097217-Jun-14 13:38 
SuggestionRe: peer to peer Pin
Richard MacCutchan17-Jun-14 22:16
mveRichard MacCutchan17-Jun-14 22:16 
AnswerRe: peer to peer Pin
jschell18-Jun-14 11:19
jschell18-Jun-14 11:19 
QuestionJava GUI programming Pin
Francesco Fraccaroli16-Jun-14 1:59
Francesco Fraccaroli16-Jun-14 1:59 
AnswerRe: Java GUI programming Pin
Richard MacCutchan16-Jun-14 3:34
mveRichard MacCutchan16-Jun-14 3:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.