tfa.losses.PinballLoss | TensorFlow Addons

文章推薦指數: 80 %
投票人數:10人

Computes the pinball loss between y_true and y_pred. ... this loss yields an estimator of the tau conditional quantile. Install Learn Introduction NewtoTensorFlow? TensorFlow ThecoreopensourceMLlibrary ForJavaScript TensorFlow.jsforMLusingJavaScript ForMobile&Edge TensorFlowLiteformobileandedgedevices ForProduction TensorFlowExtendedforend-to-endMLcomponents API TensorFlow(v2.10.0) Versions… TensorFlow.js TensorFlowLite TFX Resources Models&datasets Pre-trainedmodelsanddatasetsbuiltbyGoogleandthecommunity Tools EcosystemoftoolstohelpyouuseTensorFlow Libraries&extensions LibrariesandextensionsbuiltonTensorFlow TensorFlowCertificateprogram DifferentiateyourselfbydemonstratingyourMLproficiency LearnML EducationalresourcestolearnthefundamentalsofMLwithTensorFlow ResponsibleAI ResourcesandtoolstointegrateResponsibleAIpracticesintoyourMLworkflow Community Join Explorewaystogetinvolved Blog StayuptodatewithallthingsTensorFlow Forum↗ DiscussionplatformfortheTensorFlowcommunity Groups Usergroups,interestgroupsandmailinglists Contribute Guideforcontributingtocodeanddocumentation WhyTensorFlow About Casestudies English 中文–简体 GitHub Signin Addons Overview Guide&Tutorials API Install Learn More API More Resources More Overview Guide&Tutorials API Community More WhyTensorFlow More GitHub tfa Overviewregister_all tfa.activations Overviewgeluhardshrinklishtmishrrelusnakesoftshrinksparsemaxtanhshrink tfa.callbacks OverviewAverageModelCheckpointTQDMProgressBarTimeStopping tfa.image Overviewadjust_hsv_in_yiqangles_to_projective_transformsblendcompose_transformsconnected_componentscutoutdense_image_warpequalizeeuclidean_dist_transformgaussian_filter2dinterpolate_bilinearinterpolate_splinemean_filter2dmedian_filter2drandom_cutoutrandom_hsv_in_yiqresamplerrotatesharpnessshear_xshear_ysparse_image_warptransformtranslatetranslate_xytranslations_to_projective_transforms tfa.layers OverviewAdaptiveAveragePooling1DAdaptiveAveragePooling2DAdaptiveAveragePooling3DAdaptiveMaxPooling1DAdaptiveMaxPooling2DAdaptiveMaxPooling3DCRFCorrelationCostESNEmbeddingBagFilterResponseNormalizationGELUGroupNormalizationInstanceNormalizationMaxUnpooling2DMaxUnpooling2DV2MaxoutMultiHeadAttentionNoisyDensePoincareNormalizePolynomialCrossingSnakeSparsemaxSpatialPyramidPooling2DSpectralNormalizationStochasticDepthTLUWeightNormalization tfa.losses OverviewContrastiveLossGIoULossLiftedStructLossNpairsLossNpairsMultilabelLossPinballLossSigmoidFocalCrossEntropySparsemaxLossTripletHardLossTripletSemiHardLossWeightedKappaLosscontrastive_lossgiou_losslifted_struct_lossnpairs_lossnpairs_multilabel_losspinball_losssigmoid_focal_crossentropysparsemax_losstriplet_hard_losstriplet_semihard_loss tfa.metrics OverviewCohenKappaF1ScoreFBetaScoreGeometricMeanHammingLossHarmonicMeanKendallsTauMatthewsCorrelationCoefficientMeanMetricWrapperMultiLabelConfusionMatrixRSquarehamming_distancehamming_loss_fn tfa.optimizers OverviewAdaBeliefAdamWAveragedOptimizerWrapperCOCOBConditionalGradientCyclicalLearningRateDecoupledWeightDecayExtensionExponentialCyclicalLearningRateLAMBLazyAdamLookaheadMovingAverageMultiOptimizerNovoGradProximalAdagradRectifiedAdamSGDWSWATriangular2CyclicalLearningRateTriangularCyclicalLearningRateYogiextend_with_decoupled_weight_decay tfa.options Overviewdisable_custom_kernelenable_custom_kernelis_custom_kernel_disabled tfa.rnn OverviewESNCellLayerNormLSTMCellLayerNormSimpleRNNCellNASCellPeepholeLSTMCell tfa.seq2seq OverviewAttentionMechanismAttentionWrapperAttentionWrapperStateBahdanauAttentionBahdanauMonotonicAttentionBaseDecoderBasicDecoderBasicDecoderOutputBeamSearchDecoderBeamSearchDecoderOutputBeamSearchDecoderStateCustomSamplerDecoderFinalBeamSearchDecoderOutputGreedyEmbeddingSamplerInferenceSamplerLuongAttentionLuongMonotonicAttentionSampleEmbeddingSamplerSamplerScheduledEmbeddingTrainingSamplerScheduledOutputTrainingSamplerSequenceLossTrainingSamplerdynamic_decodegather_treegather_tree_from_arrayhardmaxmonotonic_attentionsafe_cumprodsequence_losstile_batch tfa.text OverviewCRFModelWrapperCrfDecodeForwardRnnCellcrf_binary_scorecrf_constrained_decodecrf_decodecrf_decode_backwardcrf_decode_forwardcrf_filtered_inputscrf_forwardcrf_log_likelihoodcrf_log_normcrf_multitag_sequence_scorecrf_sequence_scorecrf_unary_scoreparse_timeskip_gram_sampleskip_gram_sample_with_text_vocabviterbi_decode crf Overview tfa.types OverviewAcceptableDTypesActivationConstraintFloatTensorLikeInitializerNumberOptimizerRegularizerTensorLike Introduction TensorFlow ForJavaScript ForMobile&Edge ForProduction TensorFlow(v2.10.0) Versions… TensorFlow.js TensorFlowLite TFX Models&datasets Tools Libraries&extensions TensorFlowCertificateprogram LearnML ResponsibleAI Join Blog Forum↗ Groups Contribute About Casestudies TensorFlow Resources Addons API tfa.losses.PinballLoss Stayorganizedwithcollections Saveandcategorizecontentbasedonyourpreferences. ViewsourceonGitHub Computesthepinballlossbetweeny_trueandy_pred. tfa.losses.PinballLoss( tau:tfa.types.FloatTensorLike=0.5, reduction:str=tf.keras.losses.Reduction.AUTO, name:str='pinball_loss' ) loss=maximum(tau*(y_true-y_pred),(tau-1)*(y_true-y_pred)) Inthecontextofregression,thislossyieldsanestimatorofthetau conditionalquantile. See:https://en.wikipedia.org/wiki/Quantile_regression Usage: pinball=tfa.losses.PinballLoss(tau=.1) loss=pinball([0.,0.,1.,1.],[1.,1.,1.,0.]) loss Usagewiththetf.kerasAPI: model=tf.keras.Model() model.compile('sgd',loss=tfa.losses.PinballLoss(tau=.1)) Args tau (Optional)Floatin[0,1]oratensortakingvaluesin[0,1]and shape=[d0,...,dn].Itdefinestheslopeofthepinballloss.In thecontextofquantileregression,thevalueoftaudeterminesthe conditionalquantilelevel.Whentau=0.5,thisamountstol1 regression,anestimatoroftheconditionalmedian(0.5quantile). reduction (Optional)Typeoftf.keras.losses.Reductiontoapplyto loss.DefaultvalueisAUTO.AUTOindicatesthatthereduction optionwillbedeterminedbytheusagecontext.Foralmostallcases thisdefaultstoSUM_OVER_BATCH_SIZE. Whenusedwithtf.distribute.Strategy,outsideofbuilt-intraining loopssuchastf.kerascompileandfit,usingAUTOor SUM_OVER_BATCH_SIZEwillraiseanerror.Pleasesee https://www.tensorflow.org/alpha/tutorials/distribute/training_loops formoredetailsonthis. name Optionalnamefortheop. References: https://en.wikipedia.org/wiki/Quantile_regression https://projecteuclid.org/download/pdfview_1/euclid.bj/1297173840 Methods from_config @classmethod from_config( config ) InstantiatesaLossfromitsconfig(outputofget_config()). Args config Outputofget_config(). Returns ALossinstance. get_config Viewsource get_config() ReturnstheconfigdictionaryforaLossinstance. __call__ __call__( y_true,y_pred,sample_weight=None ) InvokestheLossinstance. Args y_true Groundtruthvalues.shape=[batch_size,d0,..dN],except sparselossfunctionssuchassparsecategoricalcrossentropywhere shape=[batch_size,d0,..dN-1] y_pred Thepredictedvalues.shape=[batch_size,d0,..dN] sample_weight Optionalsample_weightactsasacoefficientforthe loss.Ifascalarisprovided,thenthelossissimplyscaledbythe givenvalue.Ifsample_weightisatensorofsize[batch_size],then thetotallossforeachsampleofthebatchisrescaledbythe correspondingelementinthesample_weightvector.Iftheshapeof sample_weightis[batch_size,d0,..dN-1](orcanbebroadcastedto thisshape),theneachlosselementofy_predisscaled bythecorrespondingvalueofsample_weight.(NoteondN-1:allloss functionsreduceby1dimension,usuallyaxis=-1.) Returns WeightedlossfloatTensor.IfreductionisNONE,thishas shape[batch_size,d0,..dN-1];otherwise,itisscalar.(NotedN-1 becausealllossfunctionsreduceby1dimension,usuallyaxis=-1.) Raises ValueError Iftheshapeofsample_weightisinvalid. Exceptasotherwisenoted,thecontentofthispageislicensedundertheCreativeCommonsAttribution4.0License,andcodesamplesarelicensedundertheApache2.0License.Fordetails,seetheGoogleDevelopersSitePolicies.JavaisaregisteredtrademarkofOracleand/oritsaffiliates. Lastupdated2022-06-03UTC. [{ "type":"thumb-down", "id":"missingTheInformationINeed", "label":"MissingtheinformationIneed" },{ "type":"thumb-down", "id":"tooComplicatedTooManySteps", "label":"Toocomplicated/toomanysteps" },{ "type":"thumb-down", "id":"outOfDate", "label":"Outofdate" },{ "type":"thumb-down", "id":"samplesCodeIssue", "label":"Samples/codeissue" },{ "type":"thumb-down", "id":"otherDown", "label":"Other" }] [{ "type":"thumb-up", "id":"easyToUnderstand", "label":"Easytounderstand" },{ "type":"thumb-up", "id":"solvedMyProblem", "label":"Solvedmyproblem" },{ "type":"thumb-up", "id":"otherUp", "label":"Other" }] Stayconnected Blog Forum GitHub Twitter YouTube Support Issuetracker Releasenotes StackOverflow Brandguidelines CiteTensorFlow Terms Privacy SignupfortheTensorFlownewsletter Subscribe English 中文–简体



請為這篇文章評分?