void HDRStage::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if(this->getRenderTarget() != NULL) { if((whichField & BlurWidthFieldMask) || (whichField & BufferFormatFieldMask)) { this->setRenderTarget(NULL); } if(whichField & ExposureFieldMask) { _TonemapShader->updateUniformVariable("exposure", getExposure()); } if(whichField & BlurAmountFieldMask) { _TonemapShader->addUniformVariable("blurAmount", getBlurAmount()); } if(whichField & EffectAmountFieldMask) { _TonemapShader->addUniformVariable("effectAmount", getEffectAmount()); } if(whichField & GammaFieldMask) { _TonemapShader->addUniformVariable("gamma", getGamma()); } } }
void SegmentInfo::recalculateGamma() { GammaFunctions::GammaVariate * gamma = getGamma(); gamma->clearSamples(); const QwtData &tdd = sampleCurve.data(); for(unsigned i = gammaStartIndex; i <= gammaEndIndex; ++i) { if (i < tdd.size()) gamma->addSample(tdd.x(i), tdd.y(i)); } gamma->findFromSamples(); }
std::vector<double> BlackScholesGreeks::getAllGreeks() { std::vector<double> data; data.push_back(getPremium()); data.push_back(getDelta()); data.push_back(getGamma()); data.push_back(getVega()); data.push_back(getRho()); data.push_back(getTheta()); return data; }
void LevelsCommand::writeProperties(QXmlStreamWriter* writer) { AbstractCommand::writeProperties(writer); writer->writeTextElement("minin", QString::number(getMinIn())); writer->writeTextElement("maxin", QString::number(getMaxIn())); writer->writeTextElement("minout", QString::number(getMinOut())); writer->writeTextElement("maxout", QString::number(getMaxOut())); writer->writeTextElement("gamma", QString::number(getGamma())); writer->writeTextElement("transtitionDuration", QString::number(getTransitionDuration())); writer->writeTextElement("tween", getTween()); writer->writeTextElement("defer", (getDefer() == true) ? "true" : "false"); }
bool SegmentInfo::createPatlak() { if (patlakCreated) return true; if (!isGammaEnabled() || arterySegment==NULL || !arterySegment->isGammaEnabled()) return false; PatlakData pd(sampleCurve.data(), arterySegment->sampleCurve.data()); pd.setTissueBaseline(getGamma()->getBaseline()); pd.setArteryBaseline(arterySegment->getGamma()->getBaseline()); patlakCurve.setData( pd ); LinearRegressionData patlakRegressionData( patlakCurve.data() ); patlakRegression.setData(patlakRegressionData); patlakCreated = true; return true; }
void AdaptiveSO2CPGSynPlas::updateWeights() { const double& phi = getPhi(); const double& beta = getBeta(); const double& gamma = getGamma(); const double& epsilon = getEpsilon(); const double& mu = getMu(); const double& F = getOutput(2); const double& w01 = getWeight(0,1); const double& x = getOutput(0); const double& y = getOutput(1); const double& P = getPerturbation(); // general approach setPhi ( phi + mu * gamma * F * w01 * y ); setBeta ( beta + betaHebbRate * x * F - betaDecayRate * (beta - betaZero) ); setGamma ( gamma + gammaHebbRate * x * F - gammaDecayRate * (gamma - gammaZero) ); setEpsilon( epsilon + epsilonHebbRate * F * P - epsilonDecayRate * (epsilon - epsilonZero) ); }
//-------------------------------------------------------------- void ofApp::setup(){ kinect.open(); kinect.initDepthSource(); kinect.initColorSource(); kinect.initInfraredSource(); kinect.initBodyIndexSource(); kinect.initBodySource(); gui.init(); //setup a gui panel for the 3D view auto worldView = gui.addWorld("World"); worldView->onDrawWorld += [this](ofCamera &) { this->kinect.drawWorld(); }; //setup a gui panel for every kinect source auto sources = kinect.getSources(); for(auto source : sources) { auto sourceWithTexture = dynamic_pointer_cast<ofBaseHasTexture>(source); if (sourceWithTexture) { auto panel = gui.add(sourceWithTexture->getTexture(), source->getTypeName()); //if it's the colour panel, let's do something special by writing some info on top auto colorSource = dynamic_pointer_cast<ofxKFW2::Source::Color>(source); if (colorSource) { panel->onDraw += [colorSource] (ofxCvGui::DrawArguments &) { stringstream message; message << "Exposure : " << colorSource->getExposure() << "us" << endl; message << "FrameInterval : " << colorSource->getFrameInterval() << "us" << endl; message << "Gain : " << colorSource->getGain() << endl; message << "Gamma : " << colorSource->getGamma() << endl; ofxCvGui::Utils::drawText(message.str(), 20, 60); }; } //if it's the depth panel, set some scaling auto depthSource = dynamic_pointer_cast<ofxKFW2::Source::Depth>(source); if (depthSource) { auto style = make_shared<ofxCvGui::Panels::Texture::Style>(); style->rangeMaximum = 0.25f; panel->setStyle(style); } //if it's the body index panel, let's draw the joints on top auto bodyIndexSource = dynamic_pointer_cast<ofxKFW2::Source::BodyIndex>(source); if(bodyIndexSource) { panel->onDrawImage += [this](ofxCvGui::DrawImageArguments & args) { auto bodySource = this->kinect.getBodySource(); const auto & bodies = bodySource->getBodies(); ofPushStyle(); { ofColor color(200, 100, 100); int index = 0; for (const auto & body : bodies) { color.setHueAngle((index * 50) % 360); ofSetColor(color); for (const auto & joint : body.joints) { ofDrawCircle(joint.second.getPositionInDepthMap(), 5); } index++; } } ofPopStyle(); }; } } } //if we press the 'c' key on the World panel, then toggle the camera's cursor. This works best when you fullscreen that panel worldView->onKeyboard += [this, worldView] (ofxCvGui::KeyboardArguments & args) { if (args.action == ofxCvGui::KeyboardArguments::Action::Pressed && args.key =='c') { worldView->getCamera().toggleCursorDrawEnabled(); } }; }
void ColorDisplayFilter::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if(0x0000 != (whichField & (ColorTableWidthFieldMask | ColorTableHeightFieldMask | ColorTableDepthFieldMask | ColorTableFieldMask ))) { UInt32 c; std::vector<UChar8> vImageData; UInt32 uiWidth = getColorTableWidth (); UInt32 uiHeight = getColorTableHeight(); UInt32 uiDepth = getColorTableDepth (); UInt32 uiSize = (uiWidth * uiHeight * uiDepth); if(uiSize != getMFColorTable()->size() || uiDepth < 2) { // create default linear table //FWARNING(("Wrong shading table size\n")); uiWidth = uiHeight = 1; uiDepth = 2; vImageData.push_back(0); vImageData.push_back(0); vImageData.push_back(0); vImageData.push_back(255); vImageData.push_back(255); vImageData.push_back(255); } else { const MFColor3f &vColors = *(this->getMFColorTable()); vImageData.resize(uiSize * 3); for(c = 0; c < uiSize ; ++c) { vImageData[c * 3 + 0] = UChar8(vColors[c][0] * 255); vImageData[c * 3 + 1] = UChar8(vColors[c][1] * 255); vImageData[c * 3 + 2] = UChar8(vColors[c][2] * 255); } } Image *pImg = this->getTableImage(); if(pImg == NULL) { // Make Cluster Local ImageUnrecPtr pImage = Image::createLocal(FCLocal::Cluster); pImg = pImage; this->setTableImage(pImage); } pImg->set( Image::OSG_RGB_PF, uiWidth, uiHeight, uiDepth, 1, 1, 0, &vImageData[0]); SimpleSHLChunk *pShader = this->getFilterShader(); if(pShader != NULL) { pShader->addUniformVariable("shadingWidth", Int32(uiWidth)); pShader->addUniformVariable("shadingHeight", Int32(uiHeight)); pShader->addUniformVariable("shadingDepth", Int32(uiDepth)); } } if(0x0000 != (whichField & (MatrixFieldMask))) { SimpleSHLChunk *pShader = this->getFilterShader(); if(pShader != NULL) { pShader->addUniformVariable("colorMatrix", getMatrix()); } } if(0x0000 != (whichField & (GammaFieldMask))) { SimpleSHLChunk *pShader = this->getFilterShader(); if(pShader != NULL) { pShader->addUniformVariable("gamma", getGamma()); } } }
//-------------------------------------------------------------- void ofApp::setup() { kinect.open(); kinect.initDepth(); kinect.initColor(); kinect.initInfrared(); kinect.initBodyIndex(); gui.init(); //setup a gui panel for every kinect source auto sources = kinect.getSources(); for(auto source : sources) { auto drawingSource = dynamic_pointer_cast<ofBaseDraws>(source); ofxCvGui::PanelPtr panel; if (drawingSource) { panel = gui.add(*drawingSource, source->getTypeName()); auto colorSource = dynamic_pointer_cast<ofxKFW2::Source::Color>(source); if (colorSource) { panel->onDraw += [colorSource] (ofxCvGui::DrawArguments &) { stringstream message; message << "Exposure : " << colorSource->getExposure() << "us" << endl; message << "FrameInterval : " << colorSource->getFrameInterval() << "us" << endl; message << "Gain : " << colorSource->getGain() << endl; message << "Gamma : " << colorSource->getGamma() << endl; ofxCvGui::Utils::drawText(message.str(), 20, 60); }; } } } auto worldView = gui.addWorld("World"); worldView->onDrawWorld += [this] (ofCamera &) { //setup some point cloud properties for kicks glPushAttrib(GL_POINT_BIT); glPointSize(5.0f); glEnable(GL_POINT_SMOOTH); ofPushStyle(); //bind kinect color camera texture and draw mesh from depth (which has texture coordinates) this->kinect.getColor()->getTextureReference().bind(); //draw point cloud this->mesh.drawVertices(); //draw triangles ofSetColor(255, 150); this->mesh.drawWireframe(); //draw fills faded ofSetColor(255, 50); this->mesh.drawFaces(); //unbind colour camera this->kinect.getColor()->getTextureReference().unbind(); ofPopStyle(); //clear the point cloud drawing attributes glPopAttrib(); //draw the view cones of depth and colour cameras ofPushStyle(); ofNoFill(); ofSetLineWidth(2.0f); ofSetColor(100, 200, 100); this->kinect.getDepth()->drawFrustum(); ofSetColor(200, 100, 100); this->kinect.getColor()->drawFrustum(); ofPopStyle(); }; //if we press the 'c' key on the World panel, then toggle the camera's cursor. This works best when you fullscreen that panel worldView->onKeyboard += [this, worldView] (ofxCvGui::KeyboardArguments & args) { if (args.action == ofxCvGui::KeyboardArguments::Action::Pressed && args.key =='c') { worldView->getCamera().toggleCursorDraw(); } }; }
double SegmentInfo::getGammaBaseline() const { return getGamma()->getBaseline(); }
bool HMMDataSet::execBaumWelch(vector<int> *observations) { //initialize double oldProb = 0; double delta=10e+70; setObservationsAlpha(observations); // double initProb=actualProb; while (delta > DELTA) { oldProb=actualProb; // vector<vector<double> > newStateTrans(numStates, vector<double>(numStates, 0)); // vector<double> newInitialStateDist(numStates, 0); // vector<float> newObsProbDist(numStates, 0); // for (int i = 0; i < numStates; i++) { // newInitialStateDist[i] = getGamma(1, i, observations); // } // setFwdVars(observations); setBackwVars(observations); vector<vector<double> > gamma= getGamma(observations); double ***epsilon= getEpsilon(observations); //2.reestimate stateTrans double sumGamma, sumEpsilon,denominatorB,numeratorB; for (int i = 0; i < numStates; i++) { int timeLength=observations->size(); //1.reestimate newInitialStateTrans initialStateDist[i] = .001+ 0.999*gamma[0][i]; //getGamma(0, i, observations); //2.numerator sumGamma = 0; for (int time = 0; time < timeLength - 1; time++) { sumGamma += gamma[time][i]; } //3.denominator for (int j = 0; j < numStates; j++) { sumEpsilon = 0; for (int time = 0; time < timeLength - 1; time++) { sumEpsilon += epsilon[time][i][j];//getEpsilon(time, i, j, observations); } stateTrans[i][j] = .001+ 0.999*sumEpsilon / sumGamma; } denominatorB = sumGamma + gamma[timeLength- 1][i]; for (int k = 0; k < numStates; k++) { //vector<int>::iterator it=observations->begin(); numeratorB = 0.0; for (int t = 0; t < timeLength; t++) { if ((*observations)[t] == k) numeratorB += gamma[t][i]; //it++; } obsProbDist[i][k] = .001 + .999 * numeratorB / denominatorB; } }//end reestimate stateTrans // stateTrans=newStateTrans; // initialStateDist=newInitialStateDist; setObservationsAlpha(observations); delta=actualProb-oldProb; // De-Allocate memory to prevent memory leak for (int i = 0; i < observations->size(); ++i) { for (int j = 0; j < numStates; ++j) delete [] epsilon[i][j]; delete [] epsilon[i]; } delete [] epsilon; } // cout<<"BaumWelch finished init and final prob:"<<initProb<<", "<<actualProb<<endl; }
double SegmentInfo::getGammaCenterOfGravity() const { return getGamma()->getCenterOfGravity(); }
double SegmentInfo::getGammaMaximum() const { return getGamma()->getMaximum(); }
HDRStageDataTransitPtr HDRStage::setupStageData(Int32 iPixelWidth, Int32 iPixelHeight) { HDRStageDataTransitPtr returnValue = HDRStageData::createLocal(); if(returnValue == NULL) return returnValue; OSG::Thread::setCurrentLocalFlags(); // Scene Target FrameBufferObjectUnrecPtr pSceneFBO = FrameBufferObject::createLocal(); RenderBufferUnrecPtr pDepthBuffer = RenderBuffer ::createLocal(); pDepthBuffer->setInternalFormat(GL_DEPTH_COMPONENT24 ); TextureObjChunkUnrecPtr pSceneTex = TextureObjChunk::createLocal(); TextureEnvChunkUnrecPtr pSceneTexEnv = TextureEnvChunk::createLocal(); ImageUnrecPtr pImg = Image ::createLocal(); pImg->set(Image::OSG_RGB_PF, iPixelWidth, iPixelHeight, 1, 1, 1, 0.0, 0, Image::OSG_FLOAT32_IMAGEDATA, false); pSceneTex ->setImage (pImg ); pSceneTex ->setMinFilter (GL_LINEAR ); pSceneTex ->setMagFilter (GL_LINEAR ); pSceneTex ->setWrapS (GL_CLAMP_TO_EDGE ); pSceneTex ->setWrapT (GL_CLAMP_TO_EDGE ); pSceneTex ->setInternalFormat(getBufferFormat()); pSceneTexEnv->setEnvMode (GL_REPLACE ); TextureBufferUnrecPtr pSceneTexBuffer = TextureBuffer::createLocal(); pSceneTexBuffer->setTexture(pSceneTex); pSceneFBO->setSize(iPixelWidth, iPixelHeight); pSceneFBO->setColorAttachment(pSceneTexBuffer, 0); pSceneFBO->setDepthAttachment(pDepthBuffer ); pSceneFBO->editMFDrawBuffers()->push_back(GL_COLOR_ATTACHMENT0_EXT); setRenderTarget(pSceneFBO); // Shrink Target (w/2, h/2) FrameBufferObjectUnrecPtr pShrinkFBO = FrameBufferObject::createLocal(); TextureObjChunkUnrecPtr pShrinkTex = TextureObjChunk::createLocal(); TextureEnvChunkUnrecPtr pShrinkTexEnv = TextureEnvChunk::createLocal(); pImg = Image ::createLocal(); pImg->set(Image::OSG_RGB_PF, iPixelWidth / 2, iPixelHeight / 2, 1, 1, 1, 0.0, 0, Image::OSG_FLOAT32_IMAGEDATA, false); pShrinkTex ->setImage (pImg ); pShrinkTex ->setMinFilter (GL_LINEAR ); pShrinkTex ->setMagFilter (GL_LINEAR ); pShrinkTex ->setWrapS (GL_CLAMP_TO_EDGE ); pShrinkTex ->setWrapT (GL_CLAMP_TO_EDGE ); pShrinkTex ->setInternalFormat(getBufferFormat()); pShrinkTexEnv->setEnvMode (GL_REPLACE ); TextureBufferUnrecPtr pShrinkTexBuffer = TextureBuffer::createLocal(); pShrinkTexBuffer->setTexture(pShrinkTex); pShrinkFBO->setSize(iPixelWidth / 2, iPixelHeight / 2); pShrinkFBO->setColorAttachment(pShrinkTexBuffer, 0); pShrinkFBO->editMFDrawBuffers()->push_back(GL_COLOR_ATTACHMENT0_EXT); returnValue->setShrinkRenderTarget(pShrinkFBO); // blur (w/4, h/4) FrameBufferObjectUnrecPtr pBlurFBO = FrameBufferObject::createLocal(); TextureObjChunkUnrecPtr pBlurTex1 = TextureObjChunk ::createLocal(); TextureEnvChunkUnrecPtr pBlurTex1Env = TextureEnvChunk ::createLocal(); pImg = Image::createLocal(); pImg->set(Image::OSG_RGB_PF, iPixelWidth / 4, iPixelHeight / 4, 1, 1, 1, 0.0, 0, Image::OSG_FLOAT32_IMAGEDATA, false); pBlurTex1 ->setImage (pImg ); pBlurTex1 ->setMinFilter (GL_LINEAR ); pBlurTex1 ->setMagFilter (GL_LINEAR ); pBlurTex1 ->setWrapS (GL_CLAMP_TO_EDGE ); pBlurTex1 ->setWrapT (GL_CLAMP_TO_EDGE ); pBlurTex1 ->setInternalFormat(getBufferFormat()); pBlurTex1Env->setEnvMode (GL_REPLACE ); TextureBufferUnrecPtr pBlurTexBuffer1 = TextureBuffer::createLocal(); pBlurTexBuffer1->setTexture(pBlurTex1); TextureObjChunkUnrecPtr pBlurTex2 = TextureObjChunk::createLocal(); TextureEnvChunkUnrecPtr pBlurTex2Env = TextureEnvChunk::createLocal(); pImg = Image::createLocal(); pImg->set(Image::OSG_RGB_PF, iPixelWidth / 4, iPixelHeight / 4, 1, 1, 1, 0.0, 0, Image::OSG_FLOAT32_IMAGEDATA, false); pBlurTex2 ->setImage (pImg ); pBlurTex2 ->setMinFilter (GL_LINEAR ); pBlurTex2 ->setMagFilter (GL_LINEAR ); pBlurTex2 ->setWrapS (GL_CLAMP_TO_EDGE ); pBlurTex2 ->setWrapT (GL_CLAMP_TO_EDGE ); pBlurTex2 ->setInternalFormat(getBufferFormat()); pBlurTex2Env->setEnvMode (GL_REPLACE ); TextureBufferUnrecPtr pBlurTexBuffer2 = TextureBuffer::createLocal(); pBlurTexBuffer2->setTexture(pBlurTex2); pBlurFBO->setSize(iPixelWidth / 4, iPixelHeight / 4); pBlurFBO->setColorAttachment(pBlurTexBuffer1, 0); pBlurFBO->setColorAttachment(pBlurTexBuffer2, 1); returnValue->setBlurRenderTarget(pBlurFBO); // general mat chunk MaterialChunkUnrecPtr pMatChunk = MaterialChunk::createLocal(); pMatChunk->setLit(false); // tone map material ChunkMaterialUnrecPtr pTonemapMat = ChunkMaterial ::createLocal(); pTonemapMat->addChunk(pMatChunk ); pTonemapMat->addChunk(pSceneTex, 0); pTonemapMat->addChunk(pSceneTexEnv, 0); pTonemapMat->addChunk(pBlurTex1, 1); pTonemapMat->addChunk(pBlurTex1Env, 1); SimpleSHLChunkUnrecPtr pTonemapShader = generateHDRFragmentProgram(); pTonemapShader->addUniformVariable("sceneTex", 0); pTonemapShader->addUniformVariable("blurTex", 1); pTonemapShader->addUniformVariable("blurAmount", getBlurAmount ()); pTonemapShader->addUniformVariable("exposure", getExposure ()); pTonemapShader->addUniformVariable("effectAmount", getEffectAmount()); pTonemapShader->addUniformVariable("gamma", getGamma ()); pTonemapMat->addChunk(pTonemapShader, 0); returnValue->setToneMappingMaterial(pTonemapMat); // Shrink material ChunkMaterialUnrecPtr pShrinkMat = ChunkMaterial::createLocal(); pShrinkMat->addChunk(pMatChunk ); pShrinkMat->addChunk(pSceneTex, 0); pShrinkMat->addChunk(pSceneTexEnv, 0); SimpleSHLChunkUnrecPtr pShrinkShader = generate2DShrinkHalfFilterFP(); pShrinkShader->addUniformVariable("inputTex", 0); pShrinkMat->addChunk(pShrinkShader, 0); returnValue->setShrinkMaterial(pShrinkMat); // Blur material ChunkMaterialUnrecPtr pBlurMat = ChunkMaterial::createLocal(); pBlurMat->addChunk(pMatChunk ); pBlurMat->addChunk(pShrinkTex, 0); pBlurMat->addChunk(pShrinkTexEnv, 0); pBlurMat->addChunk(pBlurTex1, 1); pBlurMat->addChunk(pBlurTex1Env, 1); pBlurMat->addChunk(pBlurTex2, 2); pBlurMat->addChunk(pBlurTex2Env, 2); pBlurMat->addChunk(pShrinkShader, 0); returnValue->setBlurMaterial(pBlurMat); // generate blur fragment programs SimpleSHLChunkUnrecPtr pHBlurShader = generate1DConvolutionFilterFP(getBlurWidth(), false, true, iPixelWidth / 2, iPixelHeight / 2); pHBlurShader->addUniformVariable("inputTex", 0); returnValue->setHBlurShader(pHBlurShader); // VBlur Override SimpleSHLChunkUnrecPtr pVBlurShader = generate1DConvolutionFilterFP(getBlurWidth(), true, true, iPixelWidth / 2, iPixelHeight / 2); pVBlurShader->addUniformVariable("inputTex", 1); returnValue->setVBlurShader(pVBlurShader); OSG::Thread::resetCurrentLocalFlags(); Thread::getCurrentChangeList()->commitChanges(); return returnValue; }
string Solver::convet2CaffeFormat() { string outStr = ""; string netStrStart = "net: \""; string netStrEnd = "\"\n"; string trainNetStrStart = "train_net: \""; string trainNetStrEnd = "\"\n"; string testNetStrStart = "test_net: \""; string testNetStrEnd = "\"\n"; string testIterStrStart = "test_iter: "; string testIterStrEnd = "\n"; string testIntervalStrStart = "test_interval: "; string testIntervalStrEnd = "\n"; string baseLrStrStart = "base_lr: "; string baseLrStrEnd = "\n"; string momentumStrStart = "momentum: "; string momentumStrEnd = "\n"; string weightDecayStrStart = "weight_decay: "; string weightDecayStrEnd = "\n"; string lrPolicyStrStart = "lr_policy: \""; string lrPolicyStrEnd = "\"\n"; string stepSizeStrStart = "stepsize: "; string stepSizeStrEnd = "\n"; string gammaStrStart = "gamma: "; string gammaStrEnd = "\n"; string powerStrStart = "power: "; string powerStrEnd = "\n"; string stepValueStrStart = "stepvalue: "; string stepValueStrEnd = "\n"; string displayStrStart = "display: "; string displayStrEnd = "\n"; string maxIterStrStart = "max_iter: "; string maxIterStrEnd = "\n"; string snapshotStrStart = "snapshot: "; string snapshotStrEnd = "\n"; string snapshotPrefixStrStart = "snapshot_prefix: \""; string snapshotPrefixStrEnd = "\"\n"; string typeStrStart = "type: \""; string typeStrEnd = "\"\n"; string solveModeStrStart = "solver_mode: "; string solveModeStrEnd= "\n"; if(getNet() != "") { outStr += netStrStart + getNet() + netStrEnd; } if(getTainNet() != "") { outStr += trainNetStrStart + getTainNet() + trainNetStrEnd; } if(getTestNet() != "") { outStr += testNetStrStart + getTestNet() + testNetStrEnd; } outStr += testIterStrStart + to_string(getTestIter()) + testIterStrEnd + testIntervalStrStart + to_string(getTestInterval()) + testIntervalStrEnd + baseLrStrStart + to_string(getBaseLr()) + baseLrStrEnd + momentumStrStart + to_string(getMomentum()) + momentumStrEnd + weightDecayStrStart + to_string(getWeightDecay()) + weightDecayStrEnd; switch(getLrPolicy()) { case LrPolicy::LRPOLICY_FIXED: { outStr += lrPolicyStrStart + "fixed" + lrPolicyStrEnd; break; } case LrPolicy::LRPOLICY_STEP: { outStr += lrPolicyStrStart + "step" + lrPolicyStrEnd + stepSizeStrStart + to_string(getStepSize()) + stepSizeStrEnd + gammaStrStart + to_string(getGamma()) + gammaStrEnd; break; } case LrPolicy::LRPOLICY_EXP: { outStr += lrPolicyStrStart + "exp" + lrPolicyStrEnd + gammaStrStart + to_string(getGamma()) + gammaStrEnd; break; } case LrPolicy::LRPOLICY_INV: { outStr += lrPolicyStrStart + "inv" + lrPolicyStrEnd + gammaStrStart + to_string(getGamma()) + gammaStrEnd + powerStrStart + to_string(getPower()) + powerStrEnd; break; } case LrPolicy::LRPOLICY_MULTISTEP: { outStr += lrPolicyStrStart + "multistep" + lrPolicyStrEnd; for(int i = 0 ; i < mParam->mStepValue.size(); i++) { outStr += stepValueStrStart + to_string(getStepValue(i)) + stepValueStrEnd; } outStr += gammaStrStart + to_string(getGamma()) + gammaStrEnd; break; } case LrPolicy::LRPOLICY_POLY: { outStr += lrPolicyStrStart + "poly" + lrPolicyStrEnd + powerStrStart + to_string(getPower()) + powerStrEnd; break; } case LrPolicy::LRPOLICY_SIGMOID: { outStr += lrPolicyStrStart + "sigmoid" + lrPolicyStrEnd + stepSizeStrStart + to_string(getStepSize()) + stepSizeStrEnd + gammaStrStart + to_string(getGamma()) + gammaStrEnd; break; } } outStr += displayStrStart + to_string(getDisplay()) + displayStrEnd + maxIterStrStart + to_string(getMaxIter()) + maxIterStrEnd + snapshotStrStart + to_string(getSnapshot()) + snapshotStrEnd; if(getSnapshotPrefix() != "") { outStr += snapshotPrefixStrStart + getSnapshotPrefix() + snapshotPrefixStrEnd; } switch(getType()) { case SolverType::SGD: { outStr += typeStrStart + "SGD" + typeStrEnd; break; } case SolverType::NESTEROV: { outStr += typeStrStart + "Nesterov" + typeStrEnd; break; } case SolverType::ADAGRAD: { outStr += typeStrStart + "AdaGrad" + typeStrEnd; break; } case SolverType::RMSPROP: { outStr += typeStrStart + "RMSProp" + typeStrEnd; break; } case SolverType::ADADELTA: { outStr += typeStrStart + "AdaDelta" + typeStrEnd; break; } case SolverType::ADAM: { outStr += typeStrStart + "Adam" + typeStrEnd; break; } } switch(getSolverMode()) { case SolverMode::CPU: { outStr += solveModeStrStart + "CPU" + solveModeStrEnd; break; } case SolverMode::GPU: { outStr += solveModeStrStart + "GPU" + solveModeStrEnd; break; } } return outStr; }
// 返回服从Beta分布的随机变量的一个随机值:X~Beta(alpha1, alpha2) double getBeta(double alpha1, double alpha2) { double u1 = getGamma(alpha1, 1); double u2 = getGamma(alpha2, 1); return u1 / (u1 + u2); }
double SegmentInfo::getGammaAUC() const { return getGamma()->getAUC(); }