예제 #1
0
  void discretize (double threshold)
  {
    if (b_zscore == 0)
      {
	zscore ();
      }
    long i, j;
    for (j = 0; j < nvar; j++)
      {
	register double tmpf;
	for (i = 0; i < nsample; i++)
	  {
	    tmpf = data2d[i][j];
	    if (tmpf > threshold)
	      tmpf = 1;
	    else
	      {
		if (tmpf < -threshold)
		  tmpf = -1;
		else
		  tmpf = 0;
	      }
	    data2d[i][j] = tmpf;
	  }
      }
    b_discetize = 1;
  }
예제 #2
0
  void discretize (double threshold, int b_discretize)
  {
    long indExcludeColumn=0; //exclude the first column
    if (b_zscore == 0)
      {
	zscore (indExcludeColumn, b_discretize); //exclude the first column
      }

    if (!b_discretize) 
      return; // in this case, just generate the 2D array

    long i, j;
    for (j = 0; j < nvar; j++)
      {
        if (j==indExcludeColumn)
        {
          continue; 
        }
	register double tmpf;
	for (i = 0; i < nsample; i++)
	  {
	    tmpf = data2d[i][j];
	    if (tmpf > threshold)
	      tmpf = 1;
	    else
	      {
		if (tmpf < -threshold)
		  tmpf = -1;
		else
		  tmpf = 0;
	      }
	    data2d[i][j] = tmpf;
	  }
      }
    b_discetize = 1;
  }
예제 #3
0
bool redis_zset::zscore(const char* key, const char* member, double& result)
{
	return zscore(key, member, strlen(member), result);
}