~ubuntu-branches/ubuntu/maverick/cdk/maverick

« back to all changes in this revision

Viewing changes to src/org/openscience/cdk/qsar/model/R/CNNRegressionModelSummary.java

  • Committer: Bazaar Package Importer
  • Author(s): Paul Cager
  • Date: 2008-04-09 21:17:53 UTC
  • Revision ID: james.westby@ubuntu.com-20080409211753-46lmjw5z8mx5pd8d
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2004-2007  The Chemistry Development Kit (CDK) project
 
3
 *
 
4
 *  Contact: cdk-devel@lists.sourceforge.net
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or
 
7
 *  modify it under the terms of the GNU Lesser General Public License
 
8
 *  as published by the Free Software Foundation; either version 2.1
 
9
 *  of the License, or (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU Lesser General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU Lesser General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
19
 */
 
20
 
 
21
package org.openscience.cdk.qsar.model.R;
 
22
 
 
23
 
 
24
/** A class that represents a summary of a CNN regression model.
 
25
 *
 
26
 * This class essentially wraps the result of summary.nnet. As with other 
 
27
 * backend classes this class should not be instantiated directly by the 
 
28
 * user, though the various fields may be accessed with the provided 
 
29
 * methods.
 
30
 *
 
31
 * @author Rajarshi Guha
 
32
 * @cdk.require r-project
 
33
 * @cdk.module qsar
 
34
 * @deprecated 
 
35
 */
 
36
public class CNNRegressionModelSummary {
 
37
 
 
38
    double[] residuals;
 
39
    boolean entropy, softmax, censored;
 
40
    double value;
 
41
    int[] n;
 
42
 
 
43
    /**
 
44
     * Constructor for an object that wraps the return value from summary.lm.
 
45
     *
 
46
     * This should not be instantiated directly. The class is meant to be instantiated
 
47
     * from an R session
 
48
     *
 
49
     * @param n A 3 element array containing the number of neurons in the 
 
50
     * input, hidden and output layer respectively
 
51
     * @param entropy  A boolean indicating whether the entropy setting was used
 
52
     * @param softmax A boolean indicating whether the softmax setting was used
 
53
     * @param censored A boolean indicating whether the censored setting was used
 
54
     * @param value The final value of the convergenc criterion
 
55
     * @param residuals A 1-dimensional array of residual values
 
56
     */
 
57
    public CNNRegressionModelSummary( int[] n, boolean entropy, 
 
58
            boolean softmax, boolean censored, double value,
 
59
            double[] residuals) {
 
60
 
 
61
 
 
62
        this.residuals = new double[residuals.length];
 
63
        for (int i = 0; i < residuals.length; i++)
 
64
            this.residuals[i] = residuals[i];
 
65
 
 
66
        this.n = new int[n.length];
 
67
        for (int i = 0; i < n.length; i++) 
 
68
            this.n[i] = n[i];
 
69
 
 
70
        this.softmax = softmax;
 
71
        this.censored = censored;
 
72
        this.entropy = entropy;
 
73
        this.value = value;
 
74
    }
 
75
    /**
 
76
     * Constructor for an object that wraps the return value from summary.lm.
 
77
     *
 
78
     * This should not be instantiated directly. The class is meant to be instantiated
 
79
     * from an R session
 
80
     *
 
81
     * @param n A 3 element array containing the number of neurons in the 
 
82
     * input, hidden and output layer respectively
 
83
     * @param entropy  A boolean indicating whether the entropy setting was used
 
84
     * @param softmax A boolean indicating whether the softmax setting was used
 
85
     * @param censored A boolean indicating whether the censored setting was used
 
86
     * @param value The final value of the convergenc criterion
 
87
     * @param residuals A 1-dimensional array of residual values
 
88
     */
 
89
    public CNNRegressionModelSummary( double[] n, boolean entropy, 
 
90
            boolean softmax, boolean censored, double value,
 
91
            double[] residuals) {
 
92
 
 
93
 
 
94
        this.residuals = new double[residuals.length];
 
95
        for (int i = 0; i < residuals.length; i++)
 
96
            this.residuals[i] = residuals[i];
 
97
 
 
98
        this.n = new int[n.length];
 
99
        for (int i = 0; i < n.length; i++) 
 
100
            this.n[i] = (int)n[i];
 
101
 
 
102
        this.softmax = softmax;
 
103
        this.censored = censored;
 
104
        this.entropy = entropy;
 
105
        this.value = value;
 
106
    }
 
107
 
 
108
 
 
109
    /**
 
110
     * Return the residuals of the fit.
 
111
     *
 
112
     * @return A 1-dimensional array of doubles containing the 
 
113
     * residuals of the fit
 
114
     */
 
115
    public double[] getResiduals() {
 
116
        return(this.residuals);
 
117
    }
 
118
 
 
119
 
 
120
    /**
 
121
     * Return the number of neurons in the CNN layers.
 
122
     *
 
123
     * This method returns a 3-element array containing the number
 
124
     * of neurons in the input, hidden and output layer
 
125
     * respectively.
 
126
     *
 
127
     * @return A 3-element int array
 
128
     */
 
129
    public int[] getNumNeurons() {
 
130
        return(this.n);
 
131
    }
 
132
 
 
133
    /**
 
134
     * Return the final value of the convergence criterion.
 
135
     *
 
136
     * @return The final value of the convergence criterion
 
137
     */
 
138
    public double getValue(){
 
139
        return(this.value);
 
140
    }
 
141
 
 
142
    /**
 
143
     * Return whether softmax was used.
 
144
     *
 
145
     * @return A boolean indicating whether softmax was used or not
 
146
     */
 
147
    public boolean getSoftmax() {
 
148
        return(this.softmax);
 
149
    }
 
150
    /**
 
151
     * Return whether entropy was used.
 
152
     *
 
153
     * @return A boolean indicating whether entropy was used or not
 
154
     */
 
155
    public boolean getEntropy() {
 
156
        return(this.entropy);
 
157
    }
 
158
    /**
 
159
     * Return whether censored was used.
 
160
     *
 
161
     * @return A boolean indicating whether censored was used or not
 
162
     */
 
163
    public boolean getCensored() {
 
164
        return(this.censored);
 
165
    }
 
166
}
 
167