Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

static void Impala::Core::Training::PrecomputeTask::ComputeDevelKernel ( Database::RawDataSet dataSet,
const KernelMatrixLocator kerLoc,
CString  inputFeatures 
) [inline, static]

Definition at line 36 of file PrecomputeTask.h.

References Impala::Core::Matrix::DistributedAccess::AddFeature(), Execute(), Impala::Persistency::FeatureTableRepository::ExposeFile(), Impala::CmdOptions::GetBool(), Impala::Core::Matrix::DistributedAccess::GetColumnQuids(), Impala::Core::Feature::WeightedFeatureList::GetFeature(), Impala::Persistency::KernelMatrixLocator::GetFeatureIndexCat(), Impala::Core::Feature::VirtualFeatureTableFactory::GetInstance(), Impala::CmdOptions::GetInstance(), Impala::Core::Database::RawDataSet::GetLocator(), Impala::Persistency::KernelMatrixLocator::GetModel(), Impala::Core::Matrix::DistributedAccess::GetRowQuids(), Impala::Core::Feature::WeightedFeatureList::GetWeight(), ILOG_ERROR, ILOG_INFO, PrecomputeTask(), Impala::Persistency::File::ReadNative(), Impala::Persistency::FeatureLocator::SetFeatureString(), Impala::Core::Matrix::DistributedAccess::SetHasOwnAverages(), Impala::Persistency::FeatureLocator::SetSuffix(), Impala::Core::Feature::WeightedFeatureList::Size(), and Impala::Persistency::File::Valid().

00039     {
00040         bool override = CmdOptions::GetInstance().GetBool("override");
00041         if (DistributedAccessRepository().Exists(kerLoc) && !override)
00042         {
00043             ILOG_INFO("Skipping, Kernel already exists: " << kerLoc);
00044             return;
00045         }
00046 
00047         Feature::WeightedFeatureList fList(inputFeatures);
00048         if (fList.Size() == 0)
00049         {
00050             ILOG_ERROR("Empty feature list");
00051             return;
00052         }
00053 
00054         FeatureLocator featLoc(dataSet->GetLocator(), false, true,
00055                                kerLoc.GetFeatureIndexCat(),
00056                                fList.GetFeature(0), "");
00057         VirtualFeatureTable* features =
00058             VFTFactory::GetInstance().ConstructIOBufferReader(featLoc, true);
00059         int mSize = features->Size();
00060         DistributedAccess* kernel = new DistributedAccess(mSize, mSize, 1, 1,
00061                                                           0, 1);
00062         features->GetQuids(kernel->GetRowQuids());
00063         features->GetQuids(kernel->GetColumnQuids());
00064         delete features;
00065 
00066         bool isChi2 = (kerLoc.GetModel() == "chi2");
00067         for (int i=0 ; i<fList.Size() ; i++)
00068         {
00069             Real64 average = -1;
00070             if (isChi2)
00071             {
00072                 FeatureLocator loc = featLoc;
00073                 loc.SetSuffix(".average.raw");
00074                 loc.SetFeatureString(fList.GetFeature(i));
00075                 File file = FeatureTableRepository().ExposeFile(loc, false);
00076                 if (file.Valid())
00077                 {
00078                     std::vector<double> v;
00079                     file.ReadNative(std::back_inserter(v), true);
00080                     average = v[0];
00081                     kernel->SetHasOwnAverages(true);
00082                 }
00083                 else
00084                 {
00085                     ILOG_ERROR("Could not load average for " << loc);
00086                     delete kernel;
00087                     return;
00088                 }
00089             }
00090             kernel->AddFeature(fList.GetFeature(i), fList.GetWeight(i), average);
00091         }
00092 
00093         PrecomputeTask* pt = new PrecomputeTask(false, kerLoc, kernel, featLoc,
00094                                                 featLoc);
00095         Execute(pt);
00096     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:21:17 2011 for ImpalaSrc by  doxygen 1.5.1