The following document contains the results of PMD's CPD 3.9.
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BLOSUM62SoP.java | 101 |
| net/sourceforge/cilib/bioinf/sequencealignment/PAM250SoP.java | 99 |
if (count == alignment.size()) { // GOT ONE, PROCEED TO CLEAN UP
int which = 0;
for (String st1 : alignment) {
StringBuilder stB = new StringBuilder(st1);
stB.setCharAt(i, '*');
alignment.set(which, stB.toString());
which++;
}
}
count = 0;
}
int which2 = 0;
for (String st : alignment) {
StringTokenizer st1 = new StringTokenizer(st, "*", false);
String t = "";
while (st1.hasMoreElements()) t += st1.nextElement();
alignment.set(which2, t);
which2++;
}
/************* END ***************/
double fitness = 0.0;
double pairwiseFitness = 0.0;
int seqLength1 = alignment.get(0).length();
if (weight) {
double matchC = 0;
double mismC = 0;
//go through all the seqs (rows) SUM OF PAIRS (N * (N-1) /2)
for (int j = 0; j < alignment.size()-1; j++) {
for (int k = j+1; k < alignment.size(); k++) {
String seq1 = (String) alignment.get(j); //gets the first sequence as a String
String seq2 = (String) alignment.get(k); //gets the second sequence
// go through all columns, pairwise conmparison
for (int i = 0; i < seqLength1; i++) {
if (seq1.charAt(i) == '-' || seq2.charAt(i) == '-') continue;
if(seq1.charAt(i) == seq2.charAt(i)) matchC++;
else mismC++;
short pos1 = -1 , pos2 = -1;
// first find the corresponding letter with position in array
for(short p = 0; p < AMINO_ACID.length; p++) {
if (AMINO_ACID[p] == seq1.charAt(i)) pos1 = p;
if (AMINO_ACID[p] == seq2.charAt(i)) pos2 = p;
}
// swap if bigger
if(pos2 > pos1) pairwiseFitness+= PAM250_SUB[pos2][pos1];
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BLOSUM62SoP.java | 78 |
| net/sourceforge/cilib/bioinf/sequencealignment/Similarity.java | 69 |
}
public double getScore(ArrayList<String> alignment) {
// prints the current alignment in verbose mode
if (verbose) {
System.out.println("Raw Alignment (no clean up):");
for (String s : alignment) {
System.out.println("'" + s + "'");
}
}
/*************************************************************
* POST - PROCESSING(CLEAN UP): REMOVE ENTIRE GAPS COLUMNS *
*************************************************************/
int seqLength = alignment.get(0).length();
int count = 0;
// Iterate through the columns
for (int i = 0; i < seqLength; i++) {
for (String st : alignment) {
if (st.charAt(i) == '-') count++; //gets char at position i
}
if (count == alignment.size()) { // GOT ONE, PROCEED TO CLEAN UP
int which = 0;
for (String st1 : alignment) {
StringBuilder stB = new StringBuilder(st1);
stB.setCharAt(i, '*');
alignment.set(which, stB.toString());
which++;
}
}
count = 0;
}
int which2 = 0;
for (String st : alignment) {
StringTokenizer st1 = new StringTokenizer(st, "*", false);
String t = "";
while (st1.hasMoreElements()) t += st1.nextElement();
alignment.set(which2, t);
which2++;
}
/************* END ***************/
double fitness = 0.0;
double pairwiseFitness = 0.0;
int seqLength1 = alignment.get(0).length();
if (weight) {
double matchC = 0;
double mismC = 0;
//go through all the seqs (rows) SUM OF PAIRS (N * (N-1) /2)
for (int j = 0; j < alignment.size()-1; j++) {
for (int k = j+1; k < alignment.size(); k++) {
String seq1 = (String) alignment.get(j); //gets the first sequence as a String
String seq2 = (String) alignment.get(k); //gets the second sequence
// go through all columns, pairwise conmparison
for (int i = 0; i < seqLength1; i++) {
// MATCH
if (seq1.charAt(i) == seq2.charAt(i) &&
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/testarea/TestErrorINCLearnWithTrainer.java | 114 |
| net/sourceforge/cilib/neuralnetwork/testarea/TestSAILAwithTrainer.java | 114 |
neuralNetworkControl.setProblem(neuralNetworkProb);
neuralNetworkControl.addStoppingCondition(new MaximumIterations(1000));
// add stopping kondisie
System.out.println("Configuration completed...");
// -----------------------------------------------------------------------------------------------------------
neuralNetworkControl.initialise();
//needed
System.out.println("TEST SETUP: data stats before training:\n\n");
System.out.println("candidate set size : " + data.getCandidateSetSize());
System.out.println("training set size : " + data.getTrainingSetSize());
System.out.println("generalisation set size : " + data.getGeneralisationSetSize());
System.out.println("validation set size : " + data.getValidationSetSize());
System.out.println("Candidate set : " + data.getCandidateSetSize());
neuralNetworkControl.run();
////run die stuff
Vector in = new Vector();
in.add(new Real(0.5));
in.add(new Real(1.234));
StandardPattern p = new StandardPattern(in, null);
TypeList result = topo.evaluate(p);
System.out.println("test result f(0.5) = 0.25 --> : " + ((Real) result.get(0)).getReal());
System.out.println("data stats:\n\n");
System.out.println("candidate set size : " + data.getCandidateSetSize());
System.out.println("training set size : " + data.getTrainingSetSize());
System.out.println("generalisation set size : " + data.getGeneralisationSetSize());
System.out.println("validation set size : " + data.getValidationSetSize());
}
}
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/type/types/Int.java | 190 |
| net/sourceforge/cilib/type/types/Long.java | 197 |
return java.lang.Long.valueOf(value).doubleValue();
}
/**
* {@inheritDoc}
*/
public void setReal(double value) {
this.value = Double.valueOf(value).intValue();
}
/**
* {@inheritDoc}
*/
@Override
public void setReal(String value) {
setReal(Double.parseDouble(value));
}
/**
* {@inheritDoc}
*/
public int compareTo(Numeric other) {
if (this.value == other.getInt())
return 0;
else
return (other.getInt() < this.value) ? 1 : -1;
}
/**
* {@inheritDoc}
*/
public void randomize(Random random) {
double tmp = random.nextDouble()*(getBounds().getUpperBound()-getBounds().getLowerBound()) + getBounds().getLowerBound();
this.value = Double.valueOf(tmp).intValue();
}
/**
* {@inheritDoc}
*/
public void reset() {
this.setInt(0);
}
/**
* {@inheritDoc}
*/
public String toString() {
return String.valueOf(this.value);
}
/**
* Get the type representation of this <tt>Long</tt> object as a string.
*
* @return The String representation of this <tt>Type</tt> object.
*/
public String getRepresentation() {
return "Z(" + Double.valueOf(getBounds().getLowerBound()).intValue() + "," +
Double.valueOf(getBounds().getUpperBound()).intValue() +")";
}
/**
* Write this {@linkplain Long} to the provided {@linkplain ObjectOutput}.
* @param oos The {@linkplain ObjectOutput} to write on.
* @throws IOException If an error occurs during the write operation.
*/
public void writeExternal(ObjectOutput oos) throws IOException {
oos.writeLong(this.value);
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/PAM250SoP.java | 99 |
| net/sourceforge/cilib/bioinf/sequencealignment/Similarity.java | 92 |
if (count == alignment.size()) { // GOT ONE, PROCEED TO CLEAN UP
int which = 0;
for (String st1 : alignment) {
StringBuilder stB = new StringBuilder(st1);
stB.setCharAt(i, '*');
alignment.set(which, stB.toString());
which++;
}
}
count = 0;
}
int which2 = 0;
for (String st : alignment) {
StringTokenizer st1 = new StringTokenizer(st, "*", false);
String t = "";
while (st1.hasMoreElements()) t += st1.nextElement();
alignment.set(which2, t);
which2++;
}
/************* END ***************/
double fitness = 0.0;
double pairwiseFitness = 0.0;
int seqLength1 = alignment.get(0).length();
if (weight) {
double matchC = 0;
double mismC = 0;
//go through all the seqs (rows) SUM OF PAIRS (N * (N-1) /2)
for (int j = 0; j < alignment.size()-1; j++) {
for (int k = j+1; k < alignment.size(); k++) {
String seq1 = (String) alignment.get(j); //gets the first sequence as a String
String seq2 = (String) alignment.get(k); //gets the second sequence
// go through all columns, pairwise conmparison
for (int i = 0; i < seqLength1; i++) {
// MATCH
if (seq1.charAt(i) == seq2.charAt(i) &&
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/generic/datacontainers/CrossValidationStrategy.java | 89 |
| net/sourceforge/cilib/neuralnetwork/generic/datacontainers/RandomDistributionStrategy.java | 81 |
throw new IllegalArgumentException("Percentages for data sets do not add up to 100.");
}
}
public void populateData(ArrayList<NNPattern> dc,
ArrayList<NNPattern> dt,
ArrayList<NNPattern> dg,
ArrayList<NNPattern> dv) {
try {
inputReader = new BufferedReader(new FileReader(file));
}
catch (FileNotFoundException e) {
throw new IllegalArgumentException("Input data file not found...");
}
try {
while(inputReader.ready()) {
String line = inputReader.readLine();
StringTokenizer token = new StringTokenizer(line, " ");
if(token.countTokens() <= this.noInputs)
throw new IllegalStateException("IOException: Record lengths dont match or too many spaces in line.");
Vector input = new Vector();
Vector target = new Vector();
for (int i = 0; i < noInputs; i++){
input.add(new Real(Double.parseDouble(token.nextToken())));
}
while(token.hasMoreTokens()){
target.add(new Real(Double.parseDouble(token.nextToken())));
}
StandardPattern tmp = new StandardPattern();
tmp.setInput(input);
tmp.setTarget(target);
dc.add(tmp);
}//end while
}
catch (IOException e){
throw new IllegalStateException("IOException: Data not in correct format");
}
//======================================================
//= Distribute the patterns into Dc, Dt, Dg and Dv =
//======================================================
int totalPatterns = dc.size();
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BLOSUM62SoP.java | 78 |
| net/sourceforge/cilib/bioinf/sequencealignment/BestMatch.java | 45 |
}
/**
* Get the score of the given alignment.
* @param alignment The alignment to evaluate.
* @return the alignment score.
*/
public double getScore(ArrayList<String> alignment) {
// prints the current raw alignment in verbose mode
if (verbose) {
System.out.println("Raw Alignment (no clean up):");
for (String s : alignment) {
System.out.println("'" + s + "'");
}
}
/*************************************************************
* POST - PROCESSING(CLEAN UP): REMOVE ENTIRE GAPS COLUMNS *
*************************************************************/
int seqLength = alignment.get(0).length();
int count = 0;
// Iterate through the columns
for (int i = 0; i < seqLength; i++) {
for (String st : alignment) {
if (st.charAt(i) == '-') count++; //gets char at position i
}
if (count == alignment.size()) { // GOT ONE, PROCEED TO CLEAN UP
int which = 0;
for (String st1 : alignment) {
StringBuilder stB = new StringBuilder(st1);
stB.setCharAt(i, '*');
alignment.set(which, stB.toString());
which++;
}
}
count = 0;
}
int which2 = 0;
for (String st : alignment) {
StringTokenizer st1 = new StringTokenizer(st, "*", false);
String t="";
while (st1.hasMoreElements()) t += st1.nextElement();
alignment.set(which2, t);
which2++;
}
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/generic/topologybuilders/FFNNgenericTopologyBuilder.java | 107 |
| net/sourceforge/cilib/neuralnetwork/generic/topologybuilders/FFNNgenericTopologyBuilder.java | 153 |
if(outputActivationFunction != null)
neuron2.setOutputFunction(outputActivationFunction.getClone()); //output layer act func
else
neuron2.setOutputFunction(activationFunction.getClone()); //hidden layer act func
//set input neurons
NeuronConfig[] inputs = new NeuronConfig[network.get(layer - 1).size()];
for (int inp = 0; inp < inputs.length; inp++){
inputs[inp] = network.get(layer - 1).get(inp);
}
neuron2.setInput(inputs);
//set input weights
Weight[] w = new Weight[network.get(layer-1).size()];
for (int wi = 0; wi < w.length; wi++){
w[wi] = prototypeWeight.getClone();
}
neuron2.setInputWeights(w);
//set time step values to false
boolean[] tsH = new boolean[network.get(layer - 1).size()];
for (int inp = 0; inp < inputs.length; inp++){
tsH[inp] = false;
}
neuron2.setTimeStepMap(tsH);
neuron2.setCurrentOutput(new Real(0));
neuron2.setTminus1Output(new Real(0));
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BLOSUM62SoP.java | 152 |
| net/sourceforge/cilib/bioinf/sequencealignment/PAM250SoP.java | 150 |
else pairwiseFitness+= PAM250_SUB[pos1][pos2];
}
fitness+=pairwiseFitness / (1 + (matchC/(matchC+mismC)));
pairwiseFitness = 0;
matchC=0;
mismC=0;
}
}
}
else {
// go through all the seqs (rows) SUM OF PAIRS (N * (N-1) /2)
for (int j = 0; j < alignment.size()-1; j++) {
for (int k = j+1; k < alignment.size(); k++) {
String seq1 = (String) alignment.get(j); //gets the first sequence as a String
String seq2 = (String) alignment.get(k); //gets the second sequence
// go through all columns, pairwise conmparison
for (int i = 0; i < seqLength1; i++) {
// gaps will be penalized with the gap penalty method in use, even when it is a gap match they suppose to score 0 so it's fine to ignore them.
if (seq1.charAt(i) == '-' || seq2.charAt(i) == '-') continue;
short pos1 = -1 , pos2 = -1;
// first find the corresponding letter with position in array
for(short p = 0; p < AMINO_ACID.length; p++) {
if (AMINO_ACID[p] == seq1.charAt(i)) pos1 = p;
if (AMINO_ACID[p] == seq2.charAt(i)) pos2 = p;
}
// swap if bigger
if (pos2 > pos1) pairwiseFitness+= PAM250_SUB[pos2][pos1];
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/generic/topologybuilders/FFNNgenericTopologyBuilder.java | 71 |
| net/sourceforge/cilib/neuralnetwork/generic/topologybuilders/InputOutputGenericTopologyBuilder.java | 46 |
public ArrayList<ArrayList<NeuronConfig>> createLayerList() {
ArrayList<ArrayList<NeuronConfig>> network = new ArrayList<ArrayList<NeuronConfig>>();
ArrayList<NeuronConfig> tmp = new ArrayList<NeuronConfig>();
//construct layer 0 as a base case
for (int n = 0; n < layerSizes[0] - 1; n++){
DotProductNeuronConfig neuron = new DotProductNeuronConfig();
neuron.setOutputFunction(new LinearOutputFunction());
boolean[] tsA = new boolean[1];
tsA[0] = false;
neuron.setTimeStepMap(tsA);
neuron.setPatternWeight(new Weight(new Real(1)));
neuron.setPatternInputPos(n);
neuron.setCurrentOutput(new Real(0));
neuron.setTminus1Output(new Real(0));
neuron.setOutputNeuron(false);
tmp.add(neuron);
}
//add bias neuron
BiasNeuronConfig biasNeuron = new BiasNeuronConfig();
biasNeuron.setCurrentOutput(new Real(-1));
biasNeuron.setTminus1Output(new Real(-1));
biasNeuron.setInputWeights(null);
tmp.add(biasNeuron);
network.add(tmp);
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/moo/archive/constrained/SetBasedConstrainedArchive.java | 155 |
| net/sourceforge/cilib/moo/archive/unconstrained/QuadTree.java | 138 |
}
@Override
public boolean addAll(int index, Collection<? extends OptimisationSolution> c) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public OptimisationSolution get(int index) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public OptimisationSolution set(int index, OptimisationSolution element) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void add(int index, OptimisationSolution element) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public OptimisationSolution remove(int index) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int indexOf(Object o) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int lastIndexOf(Object o) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ListIterator<OptimisationSolution> listIterator() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ListIterator<OptimisationSolution> listIterator(int index) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<OptimisationSolution> subList(int fromIndex, int toIndex) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/generic/neuron/HyperbollicTangentOutputFunction.java | 34 |
| net/sourceforge/cilib/neuralnetwork/generic/neuron/TanHOutputFunction.java | 34 |
public TanHOutputFunction() {
}
/**
* {@inheritDoc}
*/
public Type computeDerivativeAtPos(Type pos) {
Real value = (Real) pos;
double result = 1 - Math.tanh(value.getReal())*Math.tanh(value.getReal());
return new Real(result);
}
/**
* {@inheritDoc}
*/
public Type computeDerivativeUsingLastOutput(Type lastOut) {
Real value = (Real) lastOut;
double result = 1 - Math.tanh(value.getReal())*Math.tanh(value.getReal());
return new Real(result);
}
/**
* {@inheritDoc}
*/
public Type computeFunction(Type in) {
double a = Math.exp(((Real)in).getReal());
double b = Math.exp(-((Real)in).getReal());
return new Real(((a-b)/(a+b)));
}
/**
* {@inheritDoc}
*/
public TanHOutputFunction getClone() {
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BLOSUM62SoP.java | 92 |
| net/sourceforge/cilib/bioinf/sequencealignment/GapFourFour.java | 58 |
int seqLength = alignment.get(0).length();
int count = 0;
//Iterate through the columns
for (int i = 0; i < seqLength; i++) {
for (String st : alignment) {
if (st.charAt(i) == '-') count++; //gets char at position i
}
if (count == alignment.size()) { // GOT ONE, PROCEED TO CLEAN UP
int which = 0;
for (String st1 : alignment) {
StringBuilder stB = new StringBuilder(st1);
stB.setCharAt(i, '*');
alignment.set(which, stB.toString());
which++;
}
}
count = 0;
}
int which2 = 0;
for (String st : alignment) {
StringTokenizer st1 = new StringTokenizer(st, "*", false);
String t="";
while (st1.hasMoreElements()) t += st1.nextElement();
alignment.set(which2, t);
which2++;
}
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BinaryMSAProblem.java | 132 |
| net/sourceforge/cilib/bioinf/sequencealignment/MSAProblem.java | 95 |
}
protected Fitness calculateFitness(Type solution) { // solution = particule position vector
Vector realValuedPosition = (Vector) solution;
//System.out.println("Fitness for matches: "+alignmentCreator.getFitness(strings, realValuedPosition, gapsArray)); // debug purpose
//System.out.println("Fitness for gap penalties: "+gapPenaltyMethod.getPenalty(alignmentCreator.getAlignment()); // debug purpose
//speed boost: don't calculate gaps penalty at all if weight2=0
//final fitness with weights applied
if(weight2 == 0.0) return new MaximisationFitness(new Double(weight1*alignmentCreator.getFitness(strings, realValuedPosition, gapsArray)));
else return new MaximisationFitness(new Double(weight1*alignmentCreator.getFitness(strings, realValuedPosition, gapsArray)- weight2*gapPenaltyMethod.getPenalty(alignmentCreator.getAlignment())));
}
// If gaps are allowed, make it a 20% of sequence length (in XML file). Otherwise set it to 0.
public void setMaxSequenceGapsAllowed(int number) {
if (number < 0) {
this.maxSequenceGapsAllowed = 0;
System.out.println(" ** Warning ** Negative values for specified amount of gaps allowed cannot be negative, set to 0.");
}
else
this.maxSequenceGapsAllowed = number;
}
public DomainRegistry getDomain() { //computes the domain according to the input sequences and amount of gaps to insert
if (this.domainRegistry.getDomainString() == null) {
// DomainParser parser = new DomainParser();
//reads in the input data sets.
FASTADataSetBuilder stringBuilder = (FASTADataSetBuilder) this.getDataSetBuilder();
strings = stringBuilder.getStrings();
int totalLength = 0;
for (String result : strings) {
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/functions/continuous/Michalewicz12.java | 68 |
| net/sourceforge/cilib/functions/continuous/unconstrained/Michalewicz.java | 71 |
return new Michalewicz();
}
/**
* {@inheritDoc}
*/
public Object getMinimum() {
if (this.getDimension() == 5)
return new Double(-4.687);
else if (this.getDimension() == 10)
return new Double(-9.66);
return new Double(-Double.MAX_VALUE);
}
/**
* {@inheritDoc}
*/
public double evaluate(Vector input) {
double sumsq = 0.0;
for (int i = 0; i < getDimension(); i++) {
double x = input.getReal(i);
sumsq += Math.sin(x) * Math.pow(Math.sin(((i+1) * x * x)/Math.PI), 2*m);
}
return -sumsq;
}
/**
* Get the current value of <code>M</code>.
* @return The value of <code>M</code>.
*/
public int getM() {
return m;
}
/**
* Set the value of <code>M</code>.
* @param m The value to set.
*/
public void setM(int m) {
this.m = m;
}
}
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BinaryMSAProblem.java | 178 |
| net/sourceforge/cilib/bioinf/sequencealignment/MSAProblem.java | 131 |
if (result.length() > biggestLength) biggestLength = result.length();
}
averageLength = (int) Math.round(totalLength/strings.size());
System.out.println("Got " + strings.size() + " sequences of average length: " + averageLength + ".");
/*
* ATTENTION: An alignment is only valid if all the aligned sequences are of the same length!!!!
* PRE-PROCESSING follows. Calculates the number of gaps to be inserted in each sequences and fills up an array
* used later to allocate the correct number of gaps to its respective sequence.
*/
gapsArray = new int [strings.size()];
int delta = 0;
int c = 0;
for (String aSeq : strings) {
delta = biggestLength - aSeq.length();
gapsArray[c] = delta+maxSequenceGapsAllowed;
c++;
}
for (int t = 0; t < strings.size(); t++) totalGaps+=gapsArray[t];
System.out.println("Total gaps to be added: " + totalGaps+".");
String rep = "";
//Ouputs a recommended amount of gaps to be inserted per sequence which is usually set to 20% of the longest sequence
System.out.println("Recommended number of gaps per sequence: " + Math.ceil(0.2 * averageLength) +".");
// The domain representation string
rep = "R(0, " + (biggestLength+1) + ")^" + totalGaps;
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/foundation/EvaluationMediator.java | 88 |
| net/sourceforge/cilib/neuralnetwork/generic/evaluationmediators/SAILAEvaluationMediator.java | 97 |
this.errorDg = new NNError[prototypeError.length];
this.errorDt = new NNError[prototypeError.length];
this.errorDv = new NNError[prototypeError.length];
for (int i=0; i < prototypeError.length; i++){
this.errorDg[i] = prototypeError[i].getClone();
this.errorDg[i].setNoPatterns(this.data.getGeneralisationSetSize());
this.errorDt[i] = prototypeError[i].getClone();
this.errorDt[i].setNoPatterns(this.data.getTrainingSetSize());
this.errorDv[i] = prototypeError[i].getClone();
this.errorDv[i].setNoPatterns(this.data.getValidationSetSize());
}
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/testarea/TestErrorINCLearnWithTrainer.java | 52 |
| net/sourceforge/cilib/neuralnetwork/testarea/TestSAILAwithTrainer.java | 52 |
private TestSAILAwithTrainer() {
}
public static void main(String[] args) {
int[] sizes = new int[3];
sizes[0] = 3;
sizes[1] = 6;
sizes[2] = 1;
Weight base= new Weight(new Real(0.5));
// GenericTopology topo = new GenericTopology(new FFNNStaticTopologyBuilder());
// GenericTopology topo = new GenericTopology();
GenericTopology topo = new LayeredGenericTopology();
FFNNgenericTopologyBuilder builder = new FFNNgenericTopologyBuilder();
builder.setPrototypeWeight(base);
builder.addLayer(3);
builder.addLayer(6);
builder.addLayer(1);
topo.setTopologyBuilder(builder);
FFNN_GD_TrainingStrategy trainer = new FFNN_GD_TrainingStrategy();
trainer.setDelta(new SquaredErrorFunction());
trainer.setTopology(topo);
trainer.setMomentum(0.9);
trainer.setLearningRate(0.1);
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/type/types/Int.java | 106 |
| net/sourceforge/cilib/type/types/Long.java | 106 |
hash = 31 * hash + java.lang.Long.valueOf(this.value).hashCode();
return hash;
}
/**
* {@inheritDoc}
*/
@Override
public void set(String value) {
setInt(value);
}
/**
* {@inheritDoc}
*/
@Override
public void set(boolean value) {
setBit(value);
}
/**
* {@inheritDoc}
*/
@Override
public void set(double value) {
setReal(value);
}
/**
* {@inheritDoc}
*/
@Override
public void set(int value) {
setInt(value);
}
/**
* {@inheritDoc}
*/
public boolean getBit() {
return (this.value == 0) ? false : true;
}
/**
* {@inheritDoc}
*/
public void setBit(boolean value) {
this.value = (value) ? 1 : 0;
}
/**
* {@inheritDoc}
*/
public void setBit(String value) {
setBit(Boolean.parseBoolean(value));
}
public void setLong(long value){
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/testarea/TestPostMeasure.java | 130 |
| net/sourceforge/cilib/neuralnetwork/testarea/XMLmimic.java | 123 |
measures.setOutputFile("c:\\temp\\data\\dom.txt");
AreaUnderROC auc = new AreaUnderROC();
auc.setData(data);
auc.setTopology(topo);
measures.addMeasurement(new ErrorDt(eval));
measures.addMeasurement(new ErrorDg(eval));
measures.addMeasurement(new ErrorDv(eval));
measures.addMeasurement(auc);
measures.addMeasurement(new DcPatternCount());
measures.addMeasurement(new DtPatternCount());
measures.addMeasurement(new DgPatternCount());
measures.addMeasurement(new DvPatternCount());
measures.addMeasurement(new RobelOverfittingRho());
measures.addMeasurement(new Time());
neuralNetworkControl.setMeasures(measures);
neuralNetworkControl.initialise();
System.out.println("Configuration completed...");
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/functions/continuous/dynamic/moo/fda1/FDA1_g.java | 77 |
| net/sourceforge/cilib/functions/continuous/dynamic/moo/fda2/FDA2_h.java | 156 |
}
/**
* sets the iteration number
* @param tau
*/
public void setTau(int tau) {
this.tau = tau;
}
/**
* returns the iteration number
* @return tau
*/
public int getTau() {
return this.tau;
}
/**
* sets the frequency of change
* @param tau
*/
public void setTau_t(int tau_t) {
this.tau_t = tau_t;
}
/**
* returns the frequency of change
* @return tau_t
*/
public int getTau_t() {
return this.tau_t;
}
/**
* sets the severity of change
* @param n_t
*/
public void setN_t(int n_t) {
this.n_t = n_t;
}
/**
* returns the severity of change
* @return n_t
*/
public int getN_t() {
return this.n_t;
}
/**
* Evaluates the function
* h(X_III, f_1, g) = 1-(f_1/g)^(H(t) + sum(x_i-H(t))^2)^(-1)
*/
public double evaluate(Vector x) {
this.tau = Algorithm.get().getIterations();
double t = (1.0/(double)n_t)*Math.floor((double)this.tau/(double)this.tau_t);
double H = 0.75 + 0.7*(Math.sin(0.5*Math.PI*t));
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/AlignmentCreator.java | 66 |
| net/sourceforge/cilib/bioinf/sequencealignment/BinaryAlignmentCreator.java | 58 |
ArrayList<String> tmp = new ArrayList<String>();
for (Iterator<String> l = alignment.iterator(); l.hasNext();) {
String s = new String(l.next());
tmp.add(s);
}
if (!justEvaluate) {
// Now calculate the change in representation
int counter = 0; //keep track of the ith sequence
int start = 0; // stores index of positions in vector
// - - - - Start modify solution - - - -
// First go through all the seqs
for (String s : tmp) {
int [] dummyArray = new int [gapsArray[counter]];
int change = 0; //keep track of how much gaps inserted for that sequence
StringBuilder newRepresentation = new StringBuilder(s); //copy String seq in a easy structure to modify
// *** GAP Positions ***
// Then go through #gaps allowed
for (int i = 0; i < gapsArray[counter]; i++)
dummyArray [i] = (int) Math.round(tmpSolution.elementAt(i+start));
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/neuralnetwork/testarea/TestErrorINCLearnWithTrainer.java | 86 |
| net/sourceforge/cilib/neuralnetwork/testarea/TestSAILAwithTrainer.java | 86 |
data = new SAILARealData();
RandomDistributionStrategy distributor = new RandomDistributionStrategy();
distributor.setFile("d:\\Stefan University\\masters\\datasets\\F2.txt");
distributor.setNoInputs(2);
distributor.setPercentTrain(1);
distributor.setPercentGen(20);
distributor.setPercentVal(20);
distributor.setPercentCan(59);
data.setDistributor(distributor);
data.setTopology(topo);
NNError err = new MSEErrorFunction();
err.setNoOutputs(1);
err.setNoPatterns(1000); //direct settings wont work in XML
NNError err1 = new ClassificationErrorReal();
SAILAEvaluationMediator eval = new SAILAEvaluationMediator();
eval.setTopology(topo);
eval.setData(data);
eval.addPrototypError(err);
eval.addPrototypError(err1);
eval.setTrainer(trainer);
NeuralNetworkProblem neuralNetworkProb = new NeuralNetworkProblem();
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/functions/continuous/dynamic/MovingPeaks.java | 631 |
| net/sourceforge/cilib/functions/continuous/dynamic/MovingPeaks.java | 648 |
class PeakFunctionHilly implements PeakFunction {
public double calculate(double[] gen, int peakNumber) {
int j;
double dummy;
dummy = (gen[0] - peak[peakNumber][0]) * (gen[0] - peak[peakNumber][0]);
for (j = 1; j < getDimension(); j++)
dummy += (gen[j] - peak[peakNumber][j]) * (gen[j] - peak[peakNumber][j]);
return peak[peakNumber][getDimension() + 1] - (peak[peakNumber][getDimension()] * dummy) - 0.01 * Math.sin(20.0 * dummy);
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BLOSUM62SoP.java | 69 |
| net/sourceforge/cilib/bioinf/sequencealignment/PAM250SoP.java | 68 |
{0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6, -2, 4},
};
public void setVerbose(boolean verbose) {
this.verbose = verbose;
}
public void setWeight(boolean weight) {
this.weight = weight;
}
public double getScore(ArrayList<String> alignment) {
// prints the current alignment in verbose mode
if (verbose) {
System.out.println("Raw Alignment (no clean up):");
for (String s : alignment) {
System.out.println("'" + s + "'");
}
}
/*************************************************************
* POST - PROCESSING(CLEAN UP): REMOVE ENTIRE GAPS COLUMNS *
*************************************************************/
int seqLength = alignment.get(0).length();
int count = 0;
// Iterate through the columns
for (int i = 0; i < seqLength; i++) {
for (String st : alignment)
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/problem/boundaryconstraint/BouncingBoundaryConstraint.java | 50 |
| net/sourceforge/cilib/problem/boundaryconstraint/DeflectionBoundaryConstraint.java | 66 |
}
/**
* {@inheritDoc}
*/
@Override
public void enforce(Entity entity) {
StructuredType structuredType = (StructuredType) entity.getProperties().get(EntityType.Particle.VELOCITY);
if (structuredType == null)
throw new UnsupportedOperationException("Cannot perform this boundary constrain on a "
+ entity.getClass().getSimpleName());
Iterator pIterator = entity.getCandidateSolution().iterator();
Iterator vIterator = structuredType.iterator();
while (pIterator.hasNext()) {
Numeric position = (Numeric) pIterator.next();
Numeric velocity = (Numeric) vIterator.next();
Bounds bounds = position.getBounds();
double desiredPosition = position.getReal() + velocity.getReal();
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/BestMatch.java | 74 |
| net/sourceforge/cilib/bioinf/sequencealignment/PAM250SoP.java | 99 |
if (count == alignment.size()) { // GOT ONE, PROCEED TO CLEAN UP
int which = 0;
for (String st1 : alignment) {
StringBuilder stB = new StringBuilder(st1);
stB.setCharAt(i, '*');
alignment.set(which, stB.toString());
which++;
}
}
count = 0;
}
int which2 = 0;
for (String st : alignment) {
StringTokenizer st1 = new StringTokenizer(st, "*", false);
String t = "";
while (st1.hasMoreElements()) t += st1.nextElement();
alignment.set(which2, t);
which2++;
}
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/Similarity.java | 123 |
| net/sourceforge/cilib/bioinf/sequencealignment/Similarity.java | 158 |
for (int j = 0; j < alignment.size()-1; j++) {
for (int k = j+1; k < alignment.size(); k++) {
String seq1 = (String) alignment.get(j); //gets the first sequence as a String
String seq2 = (String) alignment.get(k); //gets the second sequence
// go through all columns, pairwise conmparison
for (int i = 0; i < seqLength1; i++) {
// MATCH
if (seq1.charAt(i) == seq2.charAt(i) &&
//CONSIDER GAP MATCHES AS A GAP PENALTY, so discard them with
!(seq1.charAt(i) == '-' && seq2.charAt(i) == '-'))
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/functions/continuous/dynamic/MovingPeaks.java | 631 |
| net/sourceforge/cilib/functions/continuous/dynamic/MovingPeaks.java | 664 |
class PeakFunctionSphere implements PeakFunction {
public double calculate(double[] gen, int peakNumber) {
int j;
double dummy;
dummy = (gen[0] - peak[peakNumber][0]) * (gen[0] - peak[peakNumber][0]);
for (j = 1; j < getDimension(); j++)
dummy += (gen[j] - peak[peakNumber][j]) * (gen[j] - peak[peakNumber][j]);
return peak[peakNumber][getDimension() + 1] - dummy;
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/bioinf/sequencealignment/AlignmentCreator.java | 107 |
| net/sourceforge/cilib/bioinf/sequencealignment/BinaryAlignmentCreator.java | 101 |
change++; //inc the change counter after each addition of gaps
}
}
//*** END GAP Positions ***
tmp.set(counter, newRepresentation.toString()); //stores the modified 'gapped' sequence
//System.out.println("newRep: '" + newRepresentation.toString() + "'"); //display it for debug
start += gapsArray[counter];
counter++;
dummyArray = null;
}
}
//- - - - End modify solution - - - -
setAlignment(tmp);
return theMethod.getScore(tmp);
}
public void setScoringMethod(ScoringMethod theMethod) {
this.theMethod = theMethod;
}
public ScoringMethod getTheMethod() {
return theMethod;
}
public ArrayList<String> getAlignment() {
return align;
}
public void setAlignment(ArrayList<String> align) {
this.align = align;
}
public void setJustEvaluate(boolean justEvaluate) {
this.justEvaluate = justEvaluate;
}
}
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/functions/continuous/dynamic/MovingPeaks.java | 615 |
| net/sourceforge/cilib/functions/continuous/dynamic/MovingPeaks.java | 648 |
class PeakFunctionCone implements PeakFunction {
public double calculate(double[] gen, int peakNumber) {
int j;
double dummy;
dummy = (gen[0] - peak[peakNumber][0]) * (gen[0] - peak[peakNumber][0]);
for (j = 1; j < getDimension(); j++)
dummy += (gen[j] - peak[peakNumber][j]) * (gen[j] - peak[peakNumber][j]);
// sqrt of dummy is the distance between gen and peak.
return peak[peakNumber][getDimension() + 1] -// peak height
| |
| File | Line |
|---|---|
| net/sourceforge/cilib/problem/MaximisationFitness.java | 81 |
| net/sourceforge/cilib/problem/MinimisationFitness.java | 82 |
return -value.compareTo(other.getValue());
}
/**
* {@inheritDoc}
*/
public boolean equals(Object obj) {
if (this == obj)
return true;
if ((obj == null) || (this.getClass() != obj.getClass()))
return false;
Fitness other = (Fitness) obj;
return getValue().equals(other.getValue());
}
/**
* {@inheritDoc}
*/
public int hashCode() {
int hash = 7;
hash = 31 * hash + (value == null ? 0 : value.hashCode());
return hash;
}
| |