A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/histogram__binning_8cpp_source.html below:

NCBI C++ ToolKit: src/util/histogram_binning.cpp Source File

53  template

<

typename

TValue>

69  Uint8

total_appearances_arg )

70

: first_number(first_number_arg),

71

last_number(last_number_arg),

72

total_appearances(total_appearances_arg )

86  static_cast<int>

(eHistAlgo) );

101  typedef size_t

SIndexOfBin;

103  typedef

pair<TValue, SIndexOfBin> TDiffAndBinPair;

104  typedef

vector<TDiffAndBinPair> TVecOfDiffAndBinPair;

105

TVecOfDiffAndBinPair vecOfDiffAndBinPair;

106

vecOfDiffAndBinPair.reserve(pAnswer->size());

113  const SBin

& this_bin = (*pAnswer)[ii];

114  const SBin

& next_bin = (*pAnswer)[ii+1];

116  const TValue

difference = (

118

vecOfDiffAndBinPair.push_back(

123  sort

( vecOfDiffAndBinPair.begin(),

124

vecOfDiffAndBinPair.end(),

125

CReverseSort<TVecOfDiffAndBinPair::value_type>() );

143

vector<SIndexOfBin> vecNodesThatEndRanges;

144  ITERATE

(TVecOfDiffAndBinPair, map_iter,

147  if

( vecNodesThatEndRanges.size() >= (num_bins - 1) ) {

150

vecNodesThatEndRanges.push_back( map_iter->second );

155  sort

( vecNodesThatEndRanges.begin(),

156

vecNodesThatEndRanges.end() );

160

SIndexOfBin bin_in_range_idx = 0;

161  ITERATE

(vector<SIndexOfBin>, range_near_end_it,

162

vecNodesThatEndRanges)

164  Uint8

total_appearances_in_range = 0;

165  const Uint8

lowest_number_in_range =

166

(*pAnswer)[bin_in_range_idx].first_number;

167  for

( ; bin_in_range_idx != *range_near_end_it ;

170  const SBin

& bin = (*pAnswer)[bin_in_range_idx];

174

total_appearances_in_range += (*pAnswer)[bin_in_range_idx].total_appearances;

175  const Uint8

highest_number_in_range = (*pAnswer)[bin_in_range_idx].last_number;

176

pNewAnswer->push_back(

SBin

(lowest_number_in_range,

177

highest_number_in_range,

178

total_appearances_in_range ) );

183  Uint8

total_appearances_in_range = 0;

184  const Uint8

lowest_number_in_range =

185

(*pAnswer)[bin_in_range_idx].first_number;

186  for

( ; bin_in_range_idx != pAnswer->size(); ++bin_in_range_idx) {

187

total_appearances_in_range += (*pAnswer)[bin_in_range_idx].total_appearances;

190  const Uint8

highest_number_in_range = pAnswer->back().last_number;

191

pNewAnswer->push_back(

SBin

(lowest_number_in_range,

192

highest_number_in_range,

193

total_appearances_in_range ) );

214  Uint8

total_num_data_points = 0;

216

total_num_data_points += bin_iter->total_appearances;

220  Uint8

total_data_points_remaining = total_num_data_points;

222  const SBin

& current_input_bin = *this_bin_iter;

224  const Uint8

num_bins_remaining = (num_bins - pNewAnswer->size() );

227  const Uint8

bin_size_goal =

228

( num_bins_remaining > 0 ?

229

( total_data_points_remaining / num_bins_remaining ) :

233  if

( pNewAnswer->empty() ) {

234

pNewAnswer->push_back(current_input_bin);

235

}

else if

( pNewAnswer->back().total_appearances >= bin_size_goal )

237

pNewAnswer->push_back(current_input_bin);

239  SBin

& current_answer_bin = pNewAnswer->back();

246  _ASSERT

(total_data_points_remaining == 0);

254  Uint8

& out_num_bins)

const 256  _ASSERT

( out_listOfBins.empty() );

263  Uint8

total_appearances_of_all = 0;

267

total_appearances_of_all += value_iter->second;

272  if

( out_num_bins <= 0 ) {

273

out_num_bins = 1 +

bm::ilog2

(total_appearances_of_all);

281  const Uint8

total_appearances = value_iter->second;

282

out_listOfBins.push_back(

SBin

(

value

,

value

, total_appearances) );

286  if

( out_num_bins >= out_listOfBins.size() ) {

Bit manipulation primitives (internal)

Uint8 m_iNumBins

The number of bins to aim for the next time CalcHistogram is called.

EInitStatus x_InitializeHistogramAlgo(TListOfBins &out_listOfBins, Uint8 &out_num_bins) const

This holds the shared logic used by the various histogram algorithms.

vector< SBin > TListOfBins

A histogram is given as a vector of bins.

TListOfBins * CalcHistogram(EHistAlgo eHistAlgo=eHistAlgo_Default) const

Call this after data is loaded via AddNumber, etc.

TListOfBins * x_TryForEvenBins(void) const

Implementation of eHistAlgo_TryForSameNumDataInEachBin NOTE: Caller must deallocate the returned obje...

TListOfBins * x_IdentifyClusters(void) const

Implementation of eHistAlgo_IdentifyClusters NOTE: Caller must deallocate the returned object!

Int8 TValue

The numeric type this bins.

TMapValueToTotalAppearances m_mapValueToTotalAppearances

Maps a value to the number of times it appears, for the data given so far.

EInitStatus

shared by the various histogram algos

@ eInitStatus_AllAlgoWorkDone

This indicates that x_InitializeHistogramAlgo has done all the work required of it and the caller can...

@ eInitStatus_KeepGoing

This means the initialization completed, but the caller will need to do more work to shrink the numbe...

EHistAlgo

Pick which binning algorithm to use when generating the histogram.

@ eHistAlgo_TryForSameNumDataInEachBin

This algorithm tries to make each bin roughly even in size, except the last bin which may be much sma...

@ eHistAlgo_IdentifyClusters

This algorithm tries to make each bin represent values that are clustered together.

#define ITERATE_0_IDX(idx, up_to)

idx loops from 0 (inclusive) to up_to (exclusive)

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

element_type * release(void)

Release will release ownership of pointer to caller.

#define NCBI_USER_THROW_FMT(message)

Throw a "user exception" with message processed as output to ostream.

uint64_t Uint8

8-byte (64-bit) unsigned integer

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

Given a set of data points, automatically put them into bins for histogram display.

T ilog2(T x) noexcept

Fast loop-less function to find LOG2.

constexpr auto sort(_Init &&init)

double value_type

The numeric datatype used by the parser.

const GenericPointer< typename T::ValueType > T2 value

Defines NCBI C++ exception handling.

Holds the information about a bin.

Uint8 total_appearances

The total number of data points in this bin for all values from first_number to last_number.

SBin(TValue first_number_arg, TValue last_number_arg, Uint8 total_appearances_arg)

TValue first_number

The start range of the bin (inclusive)

TValue last_number

The end range of the bin (inclusive)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4