# Changeset 179

Ignore:
Timestamp:
Oct 4, 2004, 5:00:48 PM (19 years ago)
Message:

modified all the scores to be one-sided OR two-sided

Location:
trunk/src
Files:
7 edited

Unmodified
Removed
• ## trunk/src/Pearson.cc

 r149 r_ = a.correlation(); weighted_=false; r_=abs(r_); if (r<0 && absolute_) r_=-r_; return r_; } weighted_=true; r_=abs(r_); if (r<0 && absolute_) r_=-r_; return r_; }
• ## trunk/src/Pearson.h

 r149 /// /// \f$\frac{\vert \sum_i(x_i-\bar{x})(y_i-\bar{y})\vert }{\sqrt{\sum_i /// (x_i-\bar{x})^2\sum_i (x_i-\bar{x})^2}}\f$. /// @return absolute value of Pearson correlation. /// \f$\frac{\vert \sum_i(x_i-\bar{x})(y_i-\bar{y})\vert /// }{\sqrt{\sum_i (x_i-\bar{x})^2\sum_i (x_i-\bar{x})^2}}\f$. /// @return Pearson correlation, if absolute=true absolute value /// of Pearson is used. /// double score(const gslapi::vector&, const gslapi::vector&, const std::vector& = std::vector()); /// /// @return 1 if data correlates with target, other wise -1 /// inline int sign(void) {return (r_>0) ? 1 : -1; } /// /// The p-value is the probability of getting a correlation as
• ## trunk/src/ROC.cc

 r159 ROC::ROC() : Score(), area_(-1), data_(), minimum_size_(10), nof_pos_(0), target_(), : Score(), area_(-1), minimum_size_(10), nof_pos_(0), train_set_(std::vector()), value_(std::vector >()), //Returning score larger 0.5 that you get by random if (area_>0.5) return area_; else return 1.0-area_; if (area_<0.5 && absolute_) area_=1.0-area_; return area_; } } area_/=max_area; if (area_>0.5) return area_; else return 1-area_; if (area_<0.5 && absolute_) area_=1.0-area_; return area_; }
• ## trunk/src/ROC.h

 r160 /// Function taking \a value, \a target (+1 or -1) and vector /// defining what samples to use. The score is equivalent to /// Mann-Whitney statistics. If target is equal to 1, /// sample belonges to class + otherwise sample belongs to class /// -. @return the area under the ROC /// curve. If the area is less than 0.5, is 1-area returned. /// Mann-Whitney statistics. If target is equal to 1, sample /// belonges to class + otherwise sample belongs to class /// -. @return the area under the ROC curve. If the area is less /// than 0.5 and absolute=true, 1-area is returned. /// double score(const gslapi::vector& target, const gslapi::vector& value, /// sample belonges to class + otherwise sample belongs to class /// -. @return wheighted version of area under the ROC curve. If /// the area is less than 0.5, is 1-area returned. /// the area is less than 0.5 and absolute=true, 1-area is /// returned. /// double score(const gslapi::vector& target, const gslapi::vector& value, const std::vector& = std::vector()); /// ///Calculates the p-value, i.e. the probability of observing an area ///equally or larger if the null hypothesis is true. If P is near zero, ///this casts doubt on this hypothesis. The null hypothesis is that the ///values from the 2 classes are generated from 2 identical ///distributions. The alternative is that the median of the first ///distribution is shifted from the median of the second distribution by a ///non-zero amount. If the smallest group size is larger than minimum_size ///(default = 10), then P is calculated using a normal approximation. /// @return the one-sided p-value ///Calculates the p-value, i.e. the probability of observing an ///area equally or larger if the null hypothesis is true. If P is ///near zero, this casts doubt on this hypothesis. The null ///hypothesis is that the values from the 2 classes are generated ///from 2 identical distributions. The alternative is that the ///median of the first distribution is shifted from the median of ///the second distribution by a non-zero amount. If the smallest ///group size is larger than minimum_size (default = 10), then P ///is calculated using a normal approximation.  @return the ///one-sided p-value( if absolute true is used this is equivalent ///to the two-sided p-value.) /// double p_value() ; double p_value(void) ; /// private: double area_; gslapi::vector data_; u_int minimum_size_; u_int nof_pos_; gslapi::vector target_; std::vector train_set_; std::vector train_set_; std::vector > value_; /// pair of target and data. should always be sorted with respect to
• ## trunk/src/Score.h

 r119 ///   Constructor /// Score(void) {}; Score(bool absolute=true) ; /// virtual ~Score(void) {}; virtual double /// ///  Function changing mode of Score /// inline void absolute(bool absolute) {absolute_=absolute;} virtual double score(const gslapi::vector&, const gslapi::vector&, private: protected: bool absolute_; gslapi::vector data_; gslapi::vector target_; }; // class Score
• ## trunk/src/tScore.cc

 r148 tScore::tScore() : Score(),  t_(0), target_(), train_set_(), value_(), weight_() : Score(),  t_(0), train_set_(), weight_() { } double tScore::score(const gslapi::vector& target, const gslapi::vector& value, const gslapi::vector& data, const std::vector& train_set) { train_set_=train_set; target_ = target; value_ = value; data_ = data; weight_ = gslapi::vector(target.size(),1); Averager positive; for(size_t i=0; i0) return t_; else return -t_; if (t_<0 && absolute_) t_=-t_; return t_; } train_set_=train_set; target_ = target; value_ = value; weight_ = weight; WeightedAverager positive; for(size_t i=0; i0) return t_; else return -t_; if (t_<0 && absolute_) t_=-t_; return t_; }
• ## trunk/src/tScore.h

 r148 /// /// Calculates the absolute value of t-score, i.e. the ratio /// between difference in mean and standard deviation of this /// difference.  /// @return \f$\frac{ \vert \frac{1}{n_x}\sum x_i /// - \frac{1}{n_y}\sum y_i \vert } {\frac{\sum x_i^2 + \sum /// y_i^2}{n_x-1+n_y-1}} \f$ /// Calculates the value of t-score, i.e. the ratio between /// difference in mean and standard deviation of this /// difference. \f$\frac{ \vert \frac{1}{n_x}\sum x_i - /// \frac{1}{n_y}\sum y_i \vert } {\frac{\sum x_i^2 + \sum /// y_i^2}{n_x-1+n_y-1}} \f$ @return t-score if absolute=true /// absolute value of t-score is returned /// double score(const gslapi::vector&, const gslapi::vector&, /// /// Weighted version of t-Score /// Weighted version of t-Score @return t-score if absolute=true /// absolute value of t-score is returned /// double score(const gslapi::vector&, const gslapi::vector&, /// ///Calculates the p-value, i.e. the probability of observing a t-score ///equally or larger if the null hypothesis is true. If P is near zero, ///this casts doubt on this hypothesis. The null hypothesis is ... /// @return the one-sided p-value ///Calculates the p-value, i.e. the probability of observing a ///t-score equally or larger if the null hypothesis is true. If P ///is near zero, this casts doubt on this hypothesis. The null ///hypothesis is ...  @return the one-sided p-value( if ///absolute=true is used the two-sided p-value) /// double p_value(); private:
Note: See TracChangeset for help on using the changeset viewer.