⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 analysis.cpp

📁 模糊聚類分析源碼。包含教學文件
💻 CPP
字号:
/*    Context       : Fuzzy Clustering Algorithms  Author        : Frank Hoeppner, see also AUTHORS file   Description   : implementation of class module Analysis                    History       :      Comment       :     This file was generated automatically. DO NOT EDIT.  Copyright     : Copyright (C) 1999-2000 Frank Hoeppner    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//*  The University of Applied Sciences Oldenburg/Ostfriesland/Wilhelmshaven  hereby disclaims all copyright interests in the program package `fc'   (tool package for fuzzy cluster analysis) written by Frank Hoeppner.    Prof. Haass, President of Vice, 2000-Mar-10*/#ifndef Analysis_SOURCE#define Analysis_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "Analysis.hpp"// data// implementationtemplate <class OPT,class DATA,class PROT,class LINK>Analysis<OPT,DATA,PROT,LINK>::Analysis  (  opt_type* ap_opt,  data_set_type* ap_data,  prot_set_type* ap_prot,  link_set_type* ap_link  )  : mp_opt(ap_opt)  , mp_data_set(ap_data)  , mp_prot_set(ap_prot)  , mp_link_set(ap_link)  {  invariant(ap_opt!=NULL,"option reference ok",SOURCELOC);  invariant(ap_data!=NULL,"data set reference ok",SOURCELOC);  invariant(ap_prot!=NULL,"prototype set reference ok",SOURCELOC);  invariant(ap_link!=NULL,"link set reference ok",SOURCELOC);  }template <class OPT,class DATA,class PROT,class LINK>Analysis<OPT,DATA,PROT,LINK>::Analysis  (  Analysis<OPT,DATA,PROT,LINK>& a_analysis  )  : mp_opt(a_analysis.mp_opt)  , mp_data_set(a_analysis.mp_data_set)  , mp_prot_set(a_analysis.mp_prot_set)  , mp_link_set(a_analysis.mp_link_set)  {  }/*template <class OPT,class DATA,class PROT,class LINK>void Analysis<OPT,DATA,PROT,LINK>::substitute  (  opt_type* ap_opt,  data_set_type* ap_data,  prot_set_type* ap_prot,  link_set_type* ap_link  )  {  if (ap_opt!=NULL)  mp_opt = ap_opt;  if (ap_data!=NULL) mp_data_set = ap_data;  if (ap_prot!=NULL) mp_prot_set = ap_prot;  if (ap_link!=NULL) mp_link_set = ap_link;  }*/template <class OPT,class DATA,class PROT,class LINK>real_type Analysis<OPT,DATA,PROT,LINK>::select  (  const Selector& a_selector,  const data_type& a_feature,  int a_data_no, // no. of feature  int a_anal_no, // no. of analysis  int a_hier_level, // hierarchy level  const link_iter& i_link_begin,  const data_type* ap_prev_data  )  const  {  real_type value(0);  const int c(option().number_prototypes());  const int index(a_selector.m_index[0]);  switch (a_selector.m_type)    {    case SELECT_ZERO : value=0; break;    case SELECT_ONE  : value=1; break;    case SELECT_MONE : value=-1; break;    case SELECT_TIME : value=a_anal_no; break;    case SELECT_DATA : value=a_data_no; break;    case SELECT_HLEV : value=a_hier_level; break;    case SELECT_VALM : value=option().validity_measure(); break;    case SELECT_NPRO : value=c; break;    case SELECT_PROT : { value=-1;                         link_iter i_link(i_link_begin);                         int prot(-1);                         for (int i=0;i<c;++i)                           {                           if (value < (*i_link).membership())                             { value = (*i_link).membership(); prot = i; }                           ++i_link;                           }                         value = prot; } break;    case SELECT_ATTR : value=a_feature.select(a_selector); break;    case SELECT_DELT : value=a_feature.select(a_selector,ap_prev_data); break;    case SELECT_WEIG : value=a_feature.select(a_selector); break;    case SELECT_MEMB :    case SELECT_PMEM : { link_iter i_link(i_link_begin);                         if (index!=-1)                           {                           for (int i=0;i<index;++i) { ++i_link; }                           value = (a_selector.m_type==SELECT_MEMB)?                             (*i_link).membership():(*i_link).pow_membxweight();                           }                         else                           {                           value=0;                           for (int i=0;i<c;++i)                             {                             real_type v( (a_selector.m_type==SELECT_MEMB)?                             (*i_link).membership():(*i_link).pow_membxweight());                             value = max(value,v);                             ++i_link;                             }                           } } break;//    case SELECT_SQRD :    case SELECT_DIST : { value=1e10;                         link_iter i_link(i_link_begin);                         for (int i=0;i<c;++i)                           {                           if (a_selector.m_index[1]!=-1) // min over selected range                             { if ((a_selector.m_index[0]<=i) && (i<=a_selector.m_index[1]))                                 value = min(value,(*i_link).squared_distance());                             }                           else if (a_selector.m_index[0]==-1) // min over all prototypes                             value = min(value,(*i_link).squared_distance());                           else if (a_selector.m_index[0]==i)                             value = (*i_link).squared_distance();                            ++i_link;                            }                         if (a_selector.m_type==SELECT_DIST)                           value=sqrt(value);                         break; } break;    case SELECT_SIDE :    case SELECT_SIDI : { link_iter i_link(i_link_begin);                         for (int i=0;i<a_selector.m_index[0];++i) { ++i_link; }                         value=(*i_link).select(a_selector); } break;    default          : break;    }  return value;  }template <class OPT,class DATA,class PROT,class LINK>real_type Analysis<OPT,DATA,PROT,LINK>::select  (  const Selector& a_selector,  const prot_type& a_prototype,  int a_prot_no, // no. of prototype  int a_anal_no, // no. of analysis  int a_hier_level // hierarchy level  )  const  {  real_type value(0);  //const int index(a_selector.m_index[0]);   switch (a_selector.m_type)    {    case SELECT_ZERO : value=0; break;    case SELECT_ONE  : value=1; break;    case SELECT_MONE : value=-1; break;    case SELECT_TIME : value=a_anal_no; break;    case SELECT_DATA : value=-1; break;    case SELECT_HLEV : value=a_hier_level; break;    case SELECT_PROT : value=a_prot_no; break;    case SELECT_NPRO : value=option().number_prototypes(); break;    case SELECT_WEIG :     case SELECT_ATTR :     case SELECT_DELT : value=a_prototype.select(a_selector); break;     case SELECT_MEMB : value=1; break;    case SELECT_PMEM : value=1; break;    case SELECT_DIST : value=0; break;    case SELECT_SIDI : break;    case SELECT_SIDE : break;    case SELECT_VALM : value=option().validity_measure(); break;    default          : break;    }  return value;  }template <class OPT,class DATA,class PROT,class LINK>voidAnalysis<OPT,DATA,PROT,LINK>::get_selection_bounds  (  const Selector& a_selector,  real_type& lower,  real_type& upper  )  const  {  switch (a_selector.m_type)    {    case SELECT_ZERO :     case SELECT_ONE  :     case SELECT_MONE : lower=-1; upper=1; break;    case SELECT_MEMB :    case SELECT_PMEM :    case SELECT_SIDE : lower=0; upper=1; break;    case SELECT_DATA : lower=0; upper=option().number_features()-1; break;    case SELECT_PROT : lower=0; upper=option().number_prototypes()-1; break;    case SELECT_NPRO : lower=1; upper=option().number_prototypes(); break;    default          : break;    }  }// template instantiation#endif // Analysis_SOURCE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -