├── .gitignore ├── README.md ├── code ├── Andreas-Themos │ ├── Config.py │ ├── FaceDatasets.py │ ├── FaceNetworks.py │ ├── MetaEmbeddings.py │ ├── Readme.md │ ├── example_baseline.py │ ├── landmarks.py │ ├── utils_data.py │ ├── utils_test.py │ └── utils_train.py ├── Niko │ └── matlab │ │ ├── SRE18 │ │ ├── MLNDA_SRE18 │ │ │ ├── MLNDA_MAP_obj.m │ │ │ ├── MLNDAobj.m │ │ │ ├── create_nice_Trans.m │ │ │ ├── create_nice_Trans2.m │ │ │ ├── create_nice_Trans3.m │ │ │ ├── create_nice_Trans4.m │ │ │ ├── demo_MLNDA.m │ │ │ ├── demo_MLNDA2.m │ │ │ ├── demo_MLNDA3.m │ │ │ ├── htplda_llh.m │ │ │ ├── logdetNice.m │ │ │ ├── logdetNice2.m │ │ │ ├── logdetNice3.m │ │ │ ├── logdetNice4.m │ │ │ ├── mmd │ │ │ │ ├── gauss_mmd.m │ │ │ │ ├── log_gauss_norm.m │ │ │ │ ├── logdet_solveLU.m │ │ │ │ ├── rkhs_inner_prod.m │ │ │ │ ├── rkhs_normsq_slow.m │ │ │ │ ├── rkhs_proj_onto_I0.m │ │ │ │ └── rkhs_proj_onto_I0_slow.m │ │ │ ├── optimization │ │ │ │ ├── L_BFGS.m │ │ │ │ ├── minpack_cstep.m │ │ │ │ └── minpack_cvsrch.m │ │ │ ├── param_adaptation │ │ │ │ ├── LinvSR.m │ │ │ │ ├── adaptSPLDA.m │ │ │ │ ├── demo_adaptSPLDA.m │ │ │ │ ├── logdetLU.m │ │ │ │ ├── matinv.m │ │ │ │ ├── perturb_and_simulate_SPLDA.m │ │ │ │ ├── posteriorNorm2_slow.m │ │ │ │ ├── posteriorNorm_fast.m │ │ │ │ ├── posteriorNorm_mindiv_slow.m │ │ │ │ ├── posteriorNorm_slow.m │ │ │ │ ├── splda_adaptation_obj.m │ │ │ │ ├── splda_llh_full.m │ │ │ │ ├── train_ML_adapted_SPLDA.m │ │ │ │ └── unpack_SPLDA_adaptation_params.m │ │ │ ├── sample_HTnoise.m │ │ │ ├── simulateSPLDA.m │ │ │ ├── splda_llh.m │ │ │ ├── test │ │ │ │ ├── testBackprop.m │ │ │ │ ├── testBackprop_multi.m │ │ │ │ └── testBackprop_rs.m │ │ │ ├── train_MAP_trans.m │ │ │ └── train_ML_trans.m │ │ └── fusion and calibration │ │ │ └── llr_vs_score_plot.m │ │ ├── clean │ │ └── VB4HTPLDA │ │ │ ├── HTPLDA_SGME_train_VB.m │ │ │ ├── VB4HTPLDA_demo.m │ │ │ ├── VB4HTPLDA_iteration.m │ │ │ ├── VB4HTPLDA_iteration_2.m │ │ │ └── create_HTPLDA_SGME_backend.m │ │ ├── fous-y-tout │ │ ├── Bell.m │ │ ├── CRP │ │ │ ├── K1.table │ │ │ ├── K2.table │ │ │ ├── create_PYCRP.m │ │ │ └── randgumbel.m │ │ ├── MLNDA │ │ │ ├── LinvSR.m │ │ │ ├── MLNDAobj.m │ │ │ ├── adaptSPLDA.m │ │ │ ├── compose_trans.m │ │ │ ├── create_affineTrans.m │ │ │ ├── create_affineTrans2.m │ │ │ ├── create_diaglinTrans.m │ │ │ ├── create_iso_lowrank_trans.m │ │ │ ├── create_linTrans.m │ │ │ ├── create_linTrans2.m │ │ │ ├── create_nice_Trans.m │ │ │ ├── create_nice_Trans2.m │ │ │ ├── create_sandwich_trans.m │ │ │ ├── create_scalTrans.m │ │ │ ├── create_shiftTrans.m │ │ │ ├── demo_MLNDA.m │ │ │ ├── diag2full.m │ │ │ ├── logdetLU.m │ │ │ ├── logdetNice.m │ │ │ ├── logdetNice2.m │ │ │ ├── matmul.m │ │ │ ├── mvn_obj.m │ │ │ ├── posteriorNorm_fast.m │ │ │ ├── posteriorNorm_slow.m │ │ │ ├── simulateSPLDA.m │ │ │ ├── smvn_llh.m │ │ │ ├── splda_adaptation_obj.m │ │ │ ├── splda_llh.m │ │ │ ├── splda_llh_full.m │ │ │ ├── splda_map_adaptation_obj.m │ │ │ ├── testTransform_obj.m │ │ │ ├── test_MLNDA.m │ │ │ ├── test_MLNDA2.m │ │ │ ├── test_MLNDA3.m │ │ │ ├── test_MLNDA4.m │ │ │ └── train_ML_trans.m │ │ ├── MVG_ME_example1.m │ │ ├── MVG_ME_example2.m │ │ ├── MVG_ME_example3.m │ │ ├── MVG_ME_example4.m │ │ ├── MVG_ME_example5.m │ │ ├── Orlov2002_partitions.pdf │ │ ├── PLDA_mixture_responsibilities.m │ │ ├── ParPLDA │ │ │ ├── JPLDA_equip_with_extractor.m │ │ │ ├── SPLDA_equip_with_diagble_extractor.m │ │ │ ├── SPLDA_equip_with_extractor.m │ │ │ ├── create_diagonalized_precision.m │ │ │ ├── derive_parPLDA.m │ │ │ ├── equip_with_GME_scoring.m │ │ │ ├── equip_with_diagble_GME_scoring.m │ │ │ ├── init_SPLDA.m │ │ │ ├── test_parPLDA.m │ │ │ ├── train_JPLDA.m │ │ │ └── train_parPLDA.m │ │ ├── SDPLDA │ │ │ ├── create_semi_discrete_plda.m │ │ │ ├── create_semi_discrete_plda2.m │ │ │ └── create_semi_discrete_plda3.m │ │ ├── SGME_BXE.m │ │ ├── SGME_F2G.m │ │ ├── SGME_MXE.m │ │ ├── SGME_MXE2.m │ │ ├── SGME_extr.m │ │ ├── SGME_extr_full.m │ │ ├── SGME_extr_full_slightly_slower.m │ │ ├── SGME_extract.m │ │ ├── SGME_given_precisions_experiment.m │ │ ├── SGME_logPsL.m │ │ ├── SGME_logexpectation.m │ │ ├── SGME_logexpectation_full.m │ │ ├── SGME_logexpectation_slow.m │ │ ├── SGME_nu_experiment.m │ │ ├── SGME_nu_experiment2.m │ │ ├── SGME_train.m │ │ ├── SGME_train2.m │ │ ├── SGME_train_BXE.m │ │ ├── SGME_train_MXE.m │ │ ├── SGME_train_MXE2.m │ │ ├── SGME_train_experiment1.m │ │ ├── SGME_train_experiment2.m │ │ ├── SGME_train_experiment3.m │ │ ├── SGME_train_experiment4.m │ │ ├── SGME_train_experiment_VB.m │ │ ├── VB4HTPLDA │ │ │ └── create_HTPLDA_SGME_backend_prod.m │ │ ├── VB_vs_PsL_demo.m │ │ ├── approx_log_Bell.m │ │ ├── asChol.m │ │ ├── asEig.m │ │ ├── asEig_svd.m │ │ ├── bosaris_toolkit │ │ │ ├── binary_mixture_llh.m │ │ │ ├── calibration │ │ │ │ ├── linear_calibrate_scores.m │ │ │ │ ├── linear_calibrate_scores_dev_eval.m │ │ │ │ ├── linear_calibrate_scores_dev_eval_from_files.m │ │ │ │ ├── linear_calibrate_scores_from_files.m │ │ │ │ ├── pav_calibrate_scores.m │ │ │ │ ├── pav_calibrate_scores_dev_eval.m │ │ │ │ ├── pav_calibration.m │ │ │ │ └── train_linear_calibration.m │ │ │ ├── classes │ │ │ │ ├── @Det_Plot │ │ │ │ │ ├── Det_Plot.m │ │ │ │ │ ├── add_legend_entry.m │ │ │ │ │ ├── display_legend.m │ │ │ │ │ ├── plot_DR30_both.m │ │ │ │ │ ├── plot_DR30_fa.m │ │ │ │ │ ├── plot_DR30_miss.m │ │ │ │ │ ├── plot_det_from_roc.m │ │ │ │ │ ├── plot_mindcf_point.m │ │ │ │ │ ├── plot_rocch_det.m │ │ │ │ │ ├── plot_steppy_det.m │ │ │ │ │ ├── prepare_plot.m │ │ │ │ │ ├── save_as_pdf.m │ │ │ │ │ ├── set_system.m │ │ │ │ │ └── set_system_from_scores.m │ │ │ │ ├── @Id_Map │ │ │ │ │ ├── Id_Map.m │ │ │ │ │ ├── filter_on_left.m │ │ │ │ │ ├── filter_on_right.m │ │ │ │ │ ├── map_left_to_right.m │ │ │ │ │ ├── map_right_to_left.m │ │ │ │ │ ├── merge.m │ │ │ │ │ ├── read.m │ │ │ │ │ ├── read_hdf5.m │ │ │ │ │ ├── read_mat.m │ │ │ │ │ ├── read_txt.m │ │ │ │ │ ├── save.m │ │ │ │ │ ├── save_hdf5.m │ │ │ │ │ ├── save_mat.m │ │ │ │ │ ├── save_txt.m │ │ │ │ │ └── validate.m │ │ │ │ ├── @Key │ │ │ │ │ ├── Key.m │ │ │ │ │ ├── filter.m │ │ │ │ │ ├── merge.m │ │ │ │ │ ├── read.m │ │ │ │ │ ├── read_hdf5.m │ │ │ │ │ ├── read_mat.m │ │ │ │ │ ├── read_sre16.m │ │ │ │ │ ├── read_txt.m │ │ │ │ │ ├── save.m │ │ │ │ │ ├── save_hdf5.m │ │ │ │ │ ├── save_mat.m │ │ │ │ │ ├── save_txt.m │ │ │ │ │ ├── to_ndx.m │ │ │ │ │ └── validate.m │ │ │ │ ├── @Logger │ │ │ │ │ ├── Logger.m │ │ │ │ │ ├── add_fid.m │ │ │ │ │ ├── add_filename.m │ │ │ │ │ ├── add_stderr.m │ │ │ │ │ ├── add_stdout.m │ │ │ │ │ ├── clear.m │ │ │ │ │ ├── log.m │ │ │ │ │ ├── rm_fid.m │ │ │ │ │ ├── rm_filename.m │ │ │ │ │ ├── rm_stderr.m │ │ │ │ │ ├── rm_stdout.m │ │ │ │ │ └── validate.m │ │ │ │ ├── @Ndx │ │ │ │ │ ├── Ndx.m │ │ │ │ │ ├── filter.m │ │ │ │ │ ├── merge.m │ │ │ │ │ ├── read.m │ │ │ │ │ ├── read_hdf5.m │ │ │ │ │ ├── read_mat.m │ │ │ │ │ ├── read_nistsre16_eval.m │ │ │ │ │ ├── read_txt.m │ │ │ │ │ ├── save.m │ │ │ │ │ ├── save_hdf5.m │ │ │ │ │ ├── save_mat.m │ │ │ │ │ ├── save_txt.m │ │ │ │ │ └── validate.m │ │ │ │ ├── @Norm_DCF_Plot │ │ │ │ │ ├── Norm_DCF_Plot.m │ │ │ │ │ ├── add_legend_entry.m │ │ │ │ │ ├── display_legend.m │ │ │ │ │ ├── plot_DR30_both.m │ │ │ │ │ ├── plot_DR30_fa.m │ │ │ │ │ ├── plot_DR30_miss.m │ │ │ │ │ ├── plot_curves.m │ │ │ │ │ ├── plot_dcf_curve.m │ │ │ │ │ ├── plot_dcf_curve_act.m │ │ │ │ │ ├── plot_dcf_curve_min.m │ │ │ │ │ ├── plot_fa_rate.m │ │ │ │ │ ├── plot_fa_rate_act.m │ │ │ │ │ ├── plot_fa_rate_min.m │ │ │ │ │ ├── plot_miss_rate.m │ │ │ │ │ ├── plot_miss_rate_act.m │ │ │ │ │ ├── plot_miss_rate_min.m │ │ │ │ │ ├── plot_operating_point.m │ │ │ │ │ ├── save_as_pdf.m │ │ │ │ │ ├── set_system.m │ │ │ │ │ └── set_system_from_scores.m │ │ │ │ ├── @Quality │ │ │ │ │ ├── Quality.m │ │ │ │ │ ├── align_with_ndx.m │ │ │ │ │ ├── merge.m │ │ │ │ │ ├── read.m │ │ │ │ │ ├── read_hdf5.m │ │ │ │ │ ├── read_mat.m │ │ │ │ │ ├── save.m │ │ │ │ │ ├── save_hdf5.m │ │ │ │ │ ├── save_mat.m │ │ │ │ │ └── validate.m │ │ │ │ ├── @Results │ │ │ │ │ └── Results.m │ │ │ │ ├── @Scores │ │ │ │ │ ├── Scores.m │ │ │ │ │ ├── align_with_ndx.m │ │ │ │ │ ├── filter.m │ │ │ │ │ ├── get_scores.m │ │ │ │ │ ├── get_tar_non.m │ │ │ │ │ ├── merge.m │ │ │ │ │ ├── read.m │ │ │ │ │ ├── read_NM_Jesusito.m │ │ │ │ │ ├── read_crimdev.m │ │ │ │ │ ├── read_crimeval.m │ │ │ │ │ ├── read_hdf5.m │ │ │ │ │ ├── read_mat.m │ │ │ │ │ ├── read_txt.m │ │ │ │ │ ├── save.m │ │ │ │ │ ├── save_hdf5.m │ │ │ │ │ ├── save_mat.m │ │ │ │ │ ├── save_txt.m │ │ │ │ │ ├── set_missing_to_value.m │ │ │ │ │ ├── transform.m │ │ │ │ │ └── validate.m │ │ │ │ └── @Seg_Quality │ │ │ │ │ ├── Seg_Quality.m │ │ │ │ │ ├── align_with_ids.m │ │ │ │ │ ├── merge.m │ │ │ │ │ ├── read.m │ │ │ │ │ ├── read_hdf5.m │ │ │ │ │ ├── read_mat.m │ │ │ │ │ ├── read_txt.m │ │ │ │ │ ├── save.m │ │ │ │ │ ├── save_hdf5.m │ │ │ │ │ ├── save_mat.m │ │ │ │ │ ├── save_txt.m │ │ │ │ │ └── validate.m │ │ │ ├── demo │ │ │ │ ├── demo_fusion.m │ │ │ │ ├── demo_main.m │ │ │ │ ├── demo_make_data_for_fusion.m │ │ │ │ ├── demo_make_score_files.m │ │ │ │ ├── demo_plot_det.m │ │ │ │ ├── demo_plot_det_for_fusion.m │ │ │ │ ├── demo_plot_nber.m │ │ │ │ └── demo_with_files.m │ │ │ ├── docs │ │ │ │ └── bosaristoolkit_user_manual.pdf │ │ │ ├── fusion │ │ │ │ ├── analyse_dev_lin_and_qual_fusion.m │ │ │ │ ├── analyse_dev_lin_fusion.m │ │ │ │ ├── analyse_eval_lin_and_qual_fusion.m │ │ │ │ ├── analyse_eval_lin_fusion.m │ │ │ │ ├── apply_linear_fusion_function.m │ │ │ │ ├── apply_quality_fusion_function.m │ │ │ │ ├── funcs │ │ │ │ │ ├── AWB_sparse.m │ │ │ │ │ ├── applyQtrans.m │ │ │ │ │ ├── assemble_scr.m │ │ │ │ │ ├── estimate_target_proportions.m │ │ │ │ │ ├── evalAll.m │ │ │ │ │ ├── kldivergence_of_systems.m │ │ │ │ │ ├── make_classf_from_key.m │ │ │ │ │ ├── make_initial_fusion_weights.m │ │ │ │ │ ├── qfuser_backoff.m │ │ │ │ │ ├── qfuser_linear.m │ │ │ │ │ ├── spliceQ.m │ │ │ │ │ ├── stackQ.m │ │ │ │ │ ├── stackScores.m │ │ │ │ │ └── train_qfuser.m │ │ │ │ ├── linear_and_quality_fusion_dev_eval.m │ │ │ │ ├── linear_and_quality_fusion_dev_eval_from_files.m │ │ │ │ ├── linear_and_quality_fusion_scores.m │ │ │ │ ├── linear_and_quality_fusion_scores_from_files.m │ │ │ │ ├── linear_fusion_dev_eval.m │ │ │ │ ├── linear_fusion_dev_eval_from_files.m │ │ │ │ ├── linear_fusion_scores.m │ │ │ │ ├── linear_fusion_scores_from_files.m │ │ │ │ ├── train_linear_fuser.m │ │ │ │ ├── train_linear_fusion_function.m │ │ │ │ └── train_quality_fusion_function.m │ │ │ ├── plotting │ │ │ │ ├── dcfplot.m │ │ │ │ └── detplot.m │ │ │ ├── readme.txt │ │ │ ├── stats │ │ │ │ ├── area_under_rocch.m │ │ │ │ ├── cllr.m │ │ │ │ ├── dcf_at_threshold.m │ │ │ │ ├── eer.m │ │ │ │ ├── effective_prior.m │ │ │ │ ├── fastEval.m │ │ │ │ ├── fast_actDCF.m │ │ │ │ ├── fast_minDCF.m │ │ │ │ ├── funcs │ │ │ │ │ ├── opt_loglr.m │ │ │ │ │ └── rocch2eer.m │ │ │ │ ├── min_cllr.m │ │ │ │ └── prbep.m │ │ │ └── utility_funcs │ │ │ │ ├── Optimization_Toolkit │ │ │ │ ├── MV2DF │ │ │ │ │ ├── 2diff_chain_rules.pdf │ │ │ │ │ ├── MV2DF_API_DEFINITION.readme │ │ │ │ │ ├── WARNING_bug_when_using_singles.readme │ │ │ │ │ ├── deriv_approx │ │ │ │ │ │ ├── crstepHess.m │ │ │ │ │ │ ├── cstepHess.m │ │ │ │ │ │ ├── cstepJacobian.m │ │ │ │ │ │ ├── r2stepHess.m │ │ │ │ │ │ ├── r4stepHess.m │ │ │ │ │ │ ├── rstep.m │ │ │ │ │ │ ├── rstepHess.m │ │ │ │ │ │ └── rstepJacobian.m │ │ │ │ │ ├── discrim_training │ │ │ │ │ │ ├── score_system.m │ │ │ │ │ │ └── train_system.m │ │ │ │ │ ├── function_combination │ │ │ │ │ │ ├── compose_mv.m │ │ │ │ │ │ ├── dotprod_of_functions.m │ │ │ │ │ │ ├── dottimes_of_functions.m │ │ │ │ │ │ ├── interleave.m │ │ │ │ │ │ ├── outerprod_of_functions.m │ │ │ │ │ │ ├── product_of_functions.m │ │ │ │ │ │ ├── replace_hessian.m │ │ │ │ │ │ ├── scale_and_translate.m │ │ │ │ │ │ ├── scale_function.m │ │ │ │ │ │ ├── shift_function.m │ │ │ │ │ │ ├── stack.m │ │ │ │ │ │ └── sum_of_functions.m │ │ │ │ │ ├── function_library │ │ │ │ │ │ ├── linear │ │ │ │ │ │ │ ├── KtimesW.m │ │ │ │ │ │ │ ├── WtimesK.m │ │ │ │ │ │ │ ├── addOffset.m │ │ │ │ │ │ │ ├── addSigmaI.m │ │ │ │ │ │ │ ├── columnJofN_fh.m │ │ │ │ │ │ │ ├── fusion_mv2df.m │ │ │ │ │ │ │ ├── identity_trans.m │ │ │ │ │ │ │ ├── scaleColumns.m │ │ │ │ │ │ │ ├── scaleRows.m │ │ │ │ │ │ │ ├── subvec.m │ │ │ │ │ │ │ ├── sumcolumns_fh.m │ │ │ │ │ │ │ ├── templates │ │ │ │ │ │ │ │ ├── affineTrans.m │ │ │ │ │ │ │ │ ├── const_mv2df.m │ │ │ │ │ │ │ │ └── linTrans.m │ │ │ │ │ │ │ └── transpose_mv2df.m │ │ │ │ │ │ ├── multivariate │ │ │ │ │ │ │ ├── UtU.m │ │ │ │ │ │ │ ├── XtKX.m │ │ │ │ │ │ │ ├── bsxtimes.m │ │ │ │ │ │ │ ├── calibrateScores.m │ │ │ │ │ │ │ ├── dottimes.m │ │ │ │ │ │ │ ├── gemm.m │ │ │ │ │ │ │ ├── logsoftmax_mv2df.m │ │ │ │ │ │ │ ├── logsoftmax_trunc_mv2df.m │ │ │ │ │ │ │ ├── mm_special.m │ │ │ │ │ │ │ ├── solveChol_AXeqB.m │ │ │ │ │ │ │ ├── solve_AXeqB.m │ │ │ │ │ │ │ ├── sqdist.m │ │ │ │ │ │ │ └── sums_of_squares.m │ │ │ │ │ │ ├── scalar │ │ │ │ │ │ │ ├── boost_obj.m │ │ │ │ │ │ │ ├── brier_obj.m │ │ │ │ │ │ │ ├── cllr_obj.m │ │ │ │ │ │ │ ├── gauss_ll.m │ │ │ │ │ │ │ ├── logdet_chol.m │ │ │ │ │ │ │ ├── mce_obj.m │ │ │ │ │ │ │ ├── neg_gaussll_taylor.m │ │ │ │ │ │ │ ├── sumsquares_penalty.m │ │ │ │ │ │ │ ├── templates │ │ │ │ │ │ │ │ └── sum_ai_f_of_w_i.m │ │ │ │ │ │ │ └── wmlr_obj.m │ │ │ │ │ │ ├── test │ │ │ │ │ │ │ ├── demo_tracer.m │ │ │ │ │ │ │ ├── test_MV2DF.m │ │ │ │ │ │ │ ├── test_MV2DF_noHess.m │ │ │ │ │ │ │ └── tracer.m │ │ │ │ │ │ └── vector │ │ │ │ │ │ │ ├── exp_mv2df.m │ │ │ │ │ │ │ ├── expneg_mv2df.m │ │ │ │ │ │ │ ├── logsigmoid_fh.m │ │ │ │ │ │ │ ├── logsumexp_fh.m │ │ │ │ │ │ │ ├── logsumsquares_fh.m │ │ │ │ │ │ │ ├── neglogsigmoid_fh.m │ │ │ │ │ │ │ ├── one_over_one_plus_w_mv2df.m │ │ │ │ │ │ │ ├── sigmoid_mv2df.m │ │ │ │ │ │ │ ├── square_mv2df.m │ │ │ │ │ │ │ ├── templates │ │ │ │ │ │ │ └── vectorized_function.m │ │ │ │ │ │ │ └── what_goes_in_here.readme │ │ │ │ │ └── utils │ │ │ │ │ │ ├── inv_lu2.m │ │ │ │ │ │ ├── invchol2.m │ │ │ │ │ │ ├── invchol_or_lu.m │ │ │ │ │ │ └── invchol_taylor.m │ │ │ │ ├── TRNCG │ │ │ │ │ ├── cg_steihaug.m │ │ │ │ │ └── trustregion_newton_cg.m │ │ │ │ └── applications │ │ │ │ │ └── fusion2class │ │ │ │ │ ├── evaluate_objective.m │ │ │ │ │ ├── experiments │ │ │ │ │ ├── experiment_quality.m │ │ │ │ │ └── synth_scores_with_quality.m │ │ │ │ │ ├── mv2df_function_library │ │ │ │ │ ├── AWB_fh.m │ │ │ │ │ ├── addtotranspose_fh.m │ │ │ │ │ ├── augmentmatrix_fh.m │ │ │ │ │ ├── bsx_col_plus_row.m │ │ │ │ │ ├── duplicator_fh.m │ │ │ │ │ ├── log_distance_mv2df.m │ │ │ │ │ ├── splitvec_fh.m │ │ │ │ │ ├── square_distance_mv2df.m │ │ │ │ │ ├── subvec_fh.m │ │ │ │ │ ├── templates │ │ │ │ │ │ └── linTrans_adaptive.m │ │ │ │ │ ├── tril_to_symm_fh.m │ │ │ │ │ └── xoverxplusalpha.m │ │ │ │ │ ├── quality_modules │ │ │ │ │ ├── QQtoLLH.m │ │ │ │ │ ├── QQtoP.m │ │ │ │ │ ├── QtoLLH.m │ │ │ │ │ ├── fused_sigmoid.m │ │ │ │ │ ├── outerprod_of_sigmoids.m │ │ │ │ │ ├── parallel_cal.m │ │ │ │ │ ├── parallel_cal_augm.m │ │ │ │ │ ├── prmtrzd_sig_log_dist.m │ │ │ │ │ ├── prmtrzd_sigmoid.m │ │ │ │ │ ├── prod_of_prmtrzd_sigmoids.m │ │ │ │ │ ├── prod_sigmoid_logdist.m │ │ │ │ │ ├── sigmoid_log_sumsqdist.m │ │ │ │ │ └── sigmoid_logdistance.m │ │ │ │ │ ├── systems │ │ │ │ │ ├── aside │ │ │ │ │ │ ├── quality_fuser_v1.m │ │ │ │ │ │ ├── quality_fuser_v2.m │ │ │ │ │ │ ├── quality_fuser_v3.m │ │ │ │ │ │ └── quality_fuser_v4.m │ │ │ │ │ ├── linear_fuser.m │ │ │ │ │ ├── qfuser_v1.m │ │ │ │ │ ├── qfuser_v2.m │ │ │ │ │ ├── qfuser_v3.m │ │ │ │ │ ├── qfuser_v4.m │ │ │ │ │ ├── qfuser_v5.m │ │ │ │ │ ├── qfuser_v6.m │ │ │ │ │ ├── qfuser_v7.m │ │ │ │ │ └── scalibration │ │ │ │ │ │ ├── logsumexp_special.m │ │ │ │ │ │ ├── scal_fuser.m │ │ │ │ │ │ ├── scal_fuser_slow.m │ │ │ │ │ │ ├── scal_simple_fh.m │ │ │ │ │ │ ├── scalibration_fh.m │ │ │ │ │ │ └── scalibration_fragile_fh.m │ │ │ │ │ ├── test_binary_classifier.m │ │ │ │ │ └── train_binary_classifier.m │ │ │ │ ├── data │ │ │ │ ├── load_qual_files.m │ │ │ │ ├── load_score_files.m │ │ │ │ ├── log_error.m │ │ │ │ ├── log_info.m │ │ │ │ ├── log_warning.m │ │ │ │ ├── logprint.m │ │ │ │ ├── read_list.m │ │ │ │ ├── read_map.m │ │ │ │ ├── save_list.m │ │ │ │ └── sprintfmatrix.m │ │ │ │ ├── det │ │ │ │ ├── compute_roc.m │ │ │ │ ├── filter_roc.m │ │ │ │ ├── pavx.m │ │ │ │ ├── rocch.m │ │ │ │ └── rocchdet.m │ │ │ │ ├── manip │ │ │ │ ├── make_objective_function_from_name.m │ │ │ │ ├── map_mod_names.m │ │ │ │ ├── maplookup.m │ │ │ │ └── seg_qual_to_qual.m │ │ │ │ └── maths │ │ │ │ ├── logit.m │ │ │ │ ├── neglogsigmoid.m │ │ │ │ ├── probit.m │ │ │ │ └── sigmoid.m │ │ ├── count_Gibbs_states.m │ │ ├── create_BXE_calculator.m │ │ ├── create_GPLDA_extractor.m │ │ ├── create_HTPLDA_SGME_backend2.m │ │ ├── create_HTPLDA_extractor.m │ │ ├── create_SGME_calculator.m │ │ ├── create_TPLDA.m │ │ ├── create_flat_partition_prior.m │ │ ├── create_partition_iterator.m │ │ ├── create_partition_posterior_calculator.m │ │ ├── create_plain_GME.m │ │ ├── create_pseudolikelihood_calculator.m │ │ ├── create_pseudolikelihood_calculator_old.m │ │ ├── create_scaled_GME.m │ │ ├── dpmm │ │ │ ├── CRP │ │ │ │ ├── K1.table │ │ │ │ ├── K2.table │ │ │ │ ├── create_PYCRP.m │ │ │ │ └── randgumbel.m │ │ │ ├── NUTS-matlab-master │ │ │ │ ├── ESS.m │ │ │ │ ├── Example │ │ │ │ │ ├── NUTS_wrapper.m │ │ │ │ │ ├── SP500.mat │ │ │ │ │ ├── example_Bayesian_logistic_regression.m │ │ │ │ │ ├── example_stochastic_volatility.m │ │ │ │ │ ├── german.mat │ │ │ │ │ ├── gradLogitPosterior.m │ │ │ │ │ └── gradSvPosterior.m │ │ │ │ ├── LICENSE.md │ │ │ │ ├── NUTS.m │ │ │ │ ├── README.md │ │ │ │ ├── Recycle │ │ │ │ │ └── ReNUTS.m │ │ │ │ ├── dualAveraging.m │ │ │ │ └── getting_started_with_NUTS_and_dual_averaging_algorithm.m │ │ │ ├── assemble_truncDPMM.m │ │ │ ├── createDPMM.m │ │ │ ├── create_GibbsGMM.m │ │ │ ├── create_Label_node.m │ │ │ ├── create_SPLDA_node.m │ │ │ ├── create_fast_CollapsedGibbs.m │ │ │ ├── create_stdMVG_node.m │ │ │ ├── create_symmetricDirichlet_node.m │ │ │ ├── create_truncGMM.m │ │ │ ├── create_univariate_Laplace_node.m │ │ │ ├── create_uvg_Prior.m │ │ │ ├── gamma_vs_lognormal.m │ │ │ ├── logDirichlet.m │ │ │ ├── plots │ │ │ │ ├── 500_100_1.4_full_vs_collapsed.pdf │ │ │ │ ├── 500_100_10_full_vs_collapsed.pdf │ │ │ │ ├── 500_100_3_full_vs_collapsed.pdf │ │ │ │ ├── Gibbs_vs_VB_example1.jpg │ │ │ │ └── Gibbs_vs_VB_example2.jpg │ │ │ ├── randDirichlet.m │ │ │ ├── randg.m │ │ │ ├── stochastic_clustering.zip │ │ │ ├── t-sne │ │ │ │ ├── d2p.m │ │ │ │ ├── tSNE_matlab.zip │ │ │ │ ├── tsne.m │ │ │ │ ├── tsne_d.m │ │ │ │ ├── tsne_p.m │ │ │ │ └── x2p.m │ │ │ ├── testEER.m │ │ │ ├── test_GMM_Gibbs.m │ │ │ ├── test_GMM_Gibbs_Balerion.m │ │ │ └── trunc_gaussian │ │ │ │ └── trandn.m │ │ ├── dsolve.m │ │ ├── equip_ME.m │ │ ├── example_8_1.m │ │ ├── labels2blocks.m │ │ ├── language_recognition │ │ │ ├── TLDIvector │ │ │ │ ├── create_diagonalized_C.m │ │ │ │ ├── experiment.m │ │ │ │ ├── getPosteriorNatParams.m │ │ │ │ ├── precomputeTT.m │ │ │ │ ├── score_TLDIvector.m │ │ │ │ ├── stats2ivectors.m │ │ │ │ └── train_TLDIvector.m │ │ │ ├── T_backend │ │ │ │ ├── McClachlan_Krishnan_The_EM_algorithm_and_extensions.pdf │ │ │ │ └── create_T_backend.m │ │ │ ├── augmentation │ │ │ │ ├── augment_i_vectors.m │ │ │ │ └── create_augmenting_backend.m │ │ │ └── synth_data │ │ │ │ ├── rand_fake_Dirichlet.m │ │ │ │ ├── rand_ivector.m │ │ │ │ └── randgamma.m │ │ ├── logBell.m │ │ ├── log_pseudo_likelihood.m │ │ ├── logsumexp.m │ │ ├── optimization │ │ │ ├── L_BFGS.m │ │ │ ├── minpack_cstep.m │ │ │ └── minpack_cvsrch.m │ │ ├── plain_GME_log_expectations.m │ │ ├── plotGaussian.m │ │ ├── plotL2dist.m │ │ ├── randg.m │ │ ├── sampleARG.m │ │ ├── sampleChol.m │ │ ├── scaled_GME_precision.m │ │ ├── stochastic_clustering │ │ │ └── create_partition_posterior.m │ │ ├── sumlogsoftmax.m │ │ ├── sumlogsumexp.m │ │ ├── synthdata │ │ │ ├── sample_HTPLDA_database.m │ │ │ ├── sample_HTnoise.m │ │ │ └── sample_speaker.m │ │ ├── test │ │ │ ├── testBackprop.m │ │ │ ├── testBackprop_multi.m │ │ │ └── testBackprop_rs.m │ │ └── tme.m │ │ └── stochastic_clustering │ │ ├── create_truncGMM.m │ │ ├── logDirichlet.m │ │ ├── randDirichlet.m │ │ └── randg.m └── snapshot_for_anya │ └── matlab │ ├── Bell.m │ ├── CRP │ ├── K1.table │ ├── K2.table │ ├── create_PYCRP.m │ └── randgumbel.m │ ├── MVG_ME_example1.m │ ├── MVG_ME_example2.m │ ├── MVG_ME_example3.m │ ├── MVG_ME_example4.m │ ├── MVG_ME_example5.m │ ├── Orlov2002_partitions.pdf │ ├── PLDA_mixture_responsibilities.m │ ├── SGME_BXE.m │ ├── SGME_MXE.m │ ├── SGME_MXE2.m │ ├── SGME_extract.m │ ├── SGME_logPsL.m │ ├── SGME_logexpectation.m │ ├── SGME_train.m │ ├── SGME_train_BXE.m │ ├── SGME_train_MXE.m │ ├── SGME_train_MXE2.m │ ├── SGME_train_experiment1.m │ ├── SGME_train_experiment2.m │ ├── SGME_train_experiment3.m │ ├── SGME_train_experiment4.m │ ├── approx_log_Bell.m │ ├── asChol.m │ ├── bosaris_toolkit │ ├── binary_mixture_llh.m │ ├── calibration │ │ ├── linear_calibrate_scores.m │ │ ├── linear_calibrate_scores_dev_eval.m │ │ ├── linear_calibrate_scores_dev_eval_from_files.m │ │ ├── linear_calibrate_scores_from_files.m │ │ ├── pav_calibrate_scores.m │ │ ├── pav_calibrate_scores_dev_eval.m │ │ ├── pav_calibration.m │ │ └── train_linear_calibration.m │ ├── classes │ │ ├── @Det_Plot │ │ │ ├── Det_Plot.m │ │ │ ├── add_legend_entry.m │ │ │ ├── display_legend.m │ │ │ ├── plot_DR30_both.m │ │ │ ├── plot_DR30_fa.m │ │ │ ├── plot_DR30_miss.m │ │ │ ├── plot_det_from_roc.m │ │ │ ├── plot_mindcf_point.m │ │ │ ├── plot_rocch_det.m │ │ │ ├── plot_steppy_det.m │ │ │ ├── prepare_plot.m │ │ │ ├── save_as_pdf.m │ │ │ ├── set_system.m │ │ │ └── set_system_from_scores.m │ │ ├── @Id_Map │ │ │ ├── Id_Map.m │ │ │ ├── filter_on_left.m │ │ │ ├── filter_on_right.m │ │ │ ├── map_left_to_right.m │ │ │ ├── map_right_to_left.m │ │ │ ├── merge.m │ │ │ ├── read.m │ │ │ ├── read_hdf5.m │ │ │ ├── read_mat.m │ │ │ ├── read_txt.m │ │ │ ├── save.m │ │ │ ├── save_hdf5.m │ │ │ ├── save_mat.m │ │ │ ├── save_txt.m │ │ │ └── validate.m │ │ ├── @Key │ │ │ ├── Key.m │ │ │ ├── filter.m │ │ │ ├── merge.m │ │ │ ├── read.m │ │ │ ├── read_hdf5.m │ │ │ ├── read_mat.m │ │ │ ├── read_sre16.m │ │ │ ├── read_txt.m │ │ │ ├── save.m │ │ │ ├── save_hdf5.m │ │ │ ├── save_mat.m │ │ │ ├── save_txt.m │ │ │ ├── to_ndx.m │ │ │ └── validate.m │ │ ├── @Logger │ │ │ ├── Logger.m │ │ │ ├── add_fid.m │ │ │ ├── add_filename.m │ │ │ ├── add_stderr.m │ │ │ ├── add_stdout.m │ │ │ ├── clear.m │ │ │ ├── log.m │ │ │ ├── rm_fid.m │ │ │ ├── rm_filename.m │ │ │ ├── rm_stderr.m │ │ │ ├── rm_stdout.m │ │ │ └── validate.m │ │ ├── @Ndx │ │ │ ├── Ndx.m │ │ │ ├── filter.m │ │ │ ├── merge.m │ │ │ ├── read.m │ │ │ ├── read_hdf5.m │ │ │ ├── read_mat.m │ │ │ ├── read_nistsre16_eval.m │ │ │ ├── read_txt.m │ │ │ ├── save.m │ │ │ ├── save_hdf5.m │ │ │ ├── save_mat.m │ │ │ ├── save_txt.m │ │ │ └── validate.m │ │ ├── @Norm_DCF_Plot │ │ │ ├── Norm_DCF_Plot.m │ │ │ ├── add_legend_entry.m │ │ │ ├── display_legend.m │ │ │ ├── plot_DR30_both.m │ │ │ ├── plot_DR30_fa.m │ │ │ ├── plot_DR30_miss.m │ │ │ ├── plot_curves.m │ │ │ ├── plot_dcf_curve.m │ │ │ ├── plot_dcf_curve_act.m │ │ │ ├── plot_dcf_curve_min.m │ │ │ ├── plot_fa_rate.m │ │ │ ├── plot_fa_rate_act.m │ │ │ ├── plot_fa_rate_min.m │ │ │ ├── plot_miss_rate.m │ │ │ ├── plot_miss_rate_act.m │ │ │ ├── plot_miss_rate_min.m │ │ │ ├── plot_operating_point.m │ │ │ ├── save_as_pdf.m │ │ │ ├── set_system.m │ │ │ └── set_system_from_scores.m │ │ ├── @Quality │ │ │ ├── Quality.m │ │ │ ├── align_with_ndx.m │ │ │ ├── merge.m │ │ │ ├── read.m │ │ │ ├── read_hdf5.m │ │ │ ├── read_mat.m │ │ │ ├── save.m │ │ │ ├── save_hdf5.m │ │ │ ├── save_mat.m │ │ │ └── validate.m │ │ ├── @Results │ │ │ └── Results.m │ │ ├── @Scores │ │ │ ├── Scores.m │ │ │ ├── align_with_ndx.m │ │ │ ├── filter.m │ │ │ ├── get_scores.m │ │ │ ├── get_tar_non.m │ │ │ ├── merge.m │ │ │ ├── read.m │ │ │ ├── read_NM_Jesusito.m │ │ │ ├── read_crimdev.m │ │ │ ├── read_crimeval.m │ │ │ ├── read_hdf5.m │ │ │ ├── read_mat.m │ │ │ ├── read_txt.m │ │ │ ├── save.m │ │ │ ├── save_hdf5.m │ │ │ ├── save_mat.m │ │ │ ├── save_txt.m │ │ │ ├── set_missing_to_value.m │ │ │ ├── transform.m │ │ │ └── validate.m │ │ └── @Seg_Quality │ │ │ ├── Seg_Quality.m │ │ │ ├── align_with_ids.m │ │ │ ├── merge.m │ │ │ ├── read.m │ │ │ ├── read_hdf5.m │ │ │ ├── read_mat.m │ │ │ ├── read_txt.m │ │ │ ├── save.m │ │ │ ├── save_hdf5.m │ │ │ ├── save_mat.m │ │ │ ├── save_txt.m │ │ │ └── validate.m │ ├── demo │ │ ├── demo_fusion.m │ │ ├── demo_main.m │ │ ├── demo_make_data_for_fusion.m │ │ ├── demo_make_score_files.m │ │ ├── demo_plot_det.m │ │ ├── demo_plot_det_for_fusion.m │ │ ├── demo_plot_nber.m │ │ └── demo_with_files.m │ ├── docs │ │ └── bosaristoolkit_user_manual.pdf │ ├── fusion │ │ ├── analyse_dev_lin_and_qual_fusion.m │ │ ├── analyse_dev_lin_fusion.m │ │ ├── analyse_eval_lin_and_qual_fusion.m │ │ ├── analyse_eval_lin_fusion.m │ │ ├── apply_linear_fusion_function.m │ │ ├── apply_quality_fusion_function.m │ │ ├── funcs │ │ │ ├── AWB_sparse.m │ │ │ ├── applyQtrans.m │ │ │ ├── assemble_scr.m │ │ │ ├── estimate_target_proportions.m │ │ │ ├── evalAll.m │ │ │ ├── kldivergence_of_systems.m │ │ │ ├── make_classf_from_key.m │ │ │ ├── make_initial_fusion_weights.m │ │ │ ├── qfuser_backoff.m │ │ │ ├── qfuser_linear.m │ │ │ ├── spliceQ.m │ │ │ ├── stackQ.m │ │ │ ├── stackScores.m │ │ │ └── train_qfuser.m │ │ ├── linear_and_quality_fusion_dev_eval.m │ │ ├── linear_and_quality_fusion_dev_eval_from_files.m │ │ ├── linear_and_quality_fusion_scores.m │ │ ├── linear_and_quality_fusion_scores_from_files.m │ │ ├── linear_fusion_dev_eval.m │ │ ├── linear_fusion_dev_eval_from_files.m │ │ ├── linear_fusion_scores.m │ │ ├── linear_fusion_scores_from_files.m │ │ ├── train_linear_fuser.m │ │ ├── train_linear_fusion_function.m │ │ └── train_quality_fusion_function.m │ ├── plotting │ │ ├── dcfplot.m │ │ └── detplot.m │ ├── readme.txt │ ├── stats │ │ ├── area_under_rocch.m │ │ ├── cllr.m │ │ ├── dcf_at_threshold.m │ │ ├── eer.m │ │ ├── effective_prior.m │ │ ├── fastEval.m │ │ ├── fast_actDCF.m │ │ ├── fast_minDCF.m │ │ ├── funcs │ │ │ ├── opt_loglr.m │ │ │ └── rocch2eer.m │ │ ├── min_cllr.m │ │ └── prbep.m │ └── utility_funcs │ │ ├── Optimization_Toolkit │ │ ├── MV2DF │ │ │ ├── 2diff_chain_rules.pdf │ │ │ ├── MV2DF_API_DEFINITION.readme │ │ │ ├── WARNING_bug_when_using_singles.readme │ │ │ ├── deriv_approx │ │ │ │ ├── crstepHess.m │ │ │ │ ├── cstepHess.m │ │ │ │ ├── cstepJacobian.m │ │ │ │ ├── r2stepHess.m │ │ │ │ ├── r4stepHess.m │ │ │ │ ├── rstep.m │ │ │ │ ├── rstepHess.m │ │ │ │ └── rstepJacobian.m │ │ │ ├── discrim_training │ │ │ │ ├── score_system.m │ │ │ │ └── train_system.m │ │ │ ├── function_combination │ │ │ │ ├── compose_mv.m │ │ │ │ ├── dotprod_of_functions.m │ │ │ │ ├── dottimes_of_functions.m │ │ │ │ ├── interleave.m │ │ │ │ ├── outerprod_of_functions.m │ │ │ │ ├── product_of_functions.m │ │ │ │ ├── replace_hessian.m │ │ │ │ ├── scale_and_translate.m │ │ │ │ ├── scale_function.m │ │ │ │ ├── shift_function.m │ │ │ │ ├── stack.m │ │ │ │ └── sum_of_functions.m │ │ │ ├── function_library │ │ │ │ ├── linear │ │ │ │ │ ├── KtimesW.m │ │ │ │ │ ├── WtimesK.m │ │ │ │ │ ├── addOffset.m │ │ │ │ │ ├── addSigmaI.m │ │ │ │ │ ├── columnJofN_fh.m │ │ │ │ │ ├── fusion_mv2df.m │ │ │ │ │ ├── identity_trans.m │ │ │ │ │ ├── scaleColumns.m │ │ │ │ │ ├── scaleRows.m │ │ │ │ │ ├── subvec.m │ │ │ │ │ ├── sumcolumns_fh.m │ │ │ │ │ ├── templates │ │ │ │ │ │ ├── affineTrans.m │ │ │ │ │ │ ├── const_mv2df.m │ │ │ │ │ │ └── linTrans.m │ │ │ │ │ └── transpose_mv2df.m │ │ │ │ ├── multivariate │ │ │ │ │ ├── UtU.m │ │ │ │ │ ├── XtKX.m │ │ │ │ │ ├── bsxtimes.m │ │ │ │ │ ├── calibrateScores.m │ │ │ │ │ ├── dottimes.m │ │ │ │ │ ├── gemm.m │ │ │ │ │ ├── logsoftmax_mv2df.m │ │ │ │ │ ├── logsoftmax_trunc_mv2df.m │ │ │ │ │ ├── mm_special.m │ │ │ │ │ ├── solveChol_AXeqB.m │ │ │ │ │ ├── solve_AXeqB.m │ │ │ │ │ ├── sqdist.m │ │ │ │ │ └── sums_of_squares.m │ │ │ │ ├── scalar │ │ │ │ │ ├── boost_obj.m │ │ │ │ │ ├── brier_obj.m │ │ │ │ │ ├── cllr_obj.m │ │ │ │ │ ├── gauss_ll.m │ │ │ │ │ ├── logdet_chol.m │ │ │ │ │ ├── mce_obj.m │ │ │ │ │ ├── neg_gaussll_taylor.m │ │ │ │ │ ├── sumsquares_penalty.m │ │ │ │ │ ├── templates │ │ │ │ │ │ └── sum_ai_f_of_w_i.m │ │ │ │ │ └── wmlr_obj.m │ │ │ │ ├── test │ │ │ │ │ ├── demo_tracer.m │ │ │ │ │ ├── test_MV2DF.m │ │ │ │ │ ├── test_MV2DF_noHess.m │ │ │ │ │ └── tracer.m │ │ │ │ └── vector │ │ │ │ │ ├── exp_mv2df.m │ │ │ │ │ ├── expneg_mv2df.m │ │ │ │ │ ├── logsigmoid_fh.m │ │ │ │ │ ├── logsumexp_fh.m │ │ │ │ │ ├── logsumsquares_fh.m │ │ │ │ │ ├── neglogsigmoid_fh.m │ │ │ │ │ ├── one_over_one_plus_w_mv2df.m │ │ │ │ │ ├── sigmoid_mv2df.m │ │ │ │ │ ├── square_mv2df.m │ │ │ │ │ ├── templates │ │ │ │ │ └── vectorized_function.m │ │ │ │ │ └── what_goes_in_here.readme │ │ │ └── utils │ │ │ │ ├── inv_lu2.m │ │ │ │ ├── invchol2.m │ │ │ │ ├── invchol_or_lu.m │ │ │ │ └── invchol_taylor.m │ │ ├── TRNCG │ │ │ ├── cg_steihaug.m │ │ │ └── trustregion_newton_cg.m │ │ └── applications │ │ │ └── fusion2class │ │ │ ├── evaluate_objective.m │ │ │ ├── experiments │ │ │ ├── experiment_quality.m │ │ │ └── synth_scores_with_quality.m │ │ │ ├── mv2df_function_library │ │ │ ├── AWB_fh.m │ │ │ ├── addtotranspose_fh.m │ │ │ ├── augmentmatrix_fh.m │ │ │ ├── bsx_col_plus_row.m │ │ │ ├── duplicator_fh.m │ │ │ ├── log_distance_mv2df.m │ │ │ ├── splitvec_fh.m │ │ │ ├── square_distance_mv2df.m │ │ │ ├── subvec_fh.m │ │ │ ├── templates │ │ │ │ └── linTrans_adaptive.m │ │ │ ├── tril_to_symm_fh.m │ │ │ └── xoverxplusalpha.m │ │ │ ├── quality_modules │ │ │ ├── QQtoLLH.m │ │ │ ├── QQtoP.m │ │ │ ├── QtoLLH.m │ │ │ ├── fused_sigmoid.m │ │ │ ├── outerprod_of_sigmoids.m │ │ │ ├── parallel_cal.m │ │ │ ├── parallel_cal_augm.m │ │ │ ├── prmtrzd_sig_log_dist.m │ │ │ ├── prmtrzd_sigmoid.m │ │ │ ├── prod_of_prmtrzd_sigmoids.m │ │ │ ├── prod_sigmoid_logdist.m │ │ │ ├── sigmoid_log_sumsqdist.m │ │ │ └── sigmoid_logdistance.m │ │ │ ├── systems │ │ │ ├── aside │ │ │ │ ├── quality_fuser_v1.m │ │ │ │ ├── quality_fuser_v2.m │ │ │ │ ├── quality_fuser_v3.m │ │ │ │ └── quality_fuser_v4.m │ │ │ ├── linear_fuser.m │ │ │ ├── qfuser_v1.m │ │ │ ├── qfuser_v2.m │ │ │ ├── qfuser_v3.m │ │ │ ├── qfuser_v4.m │ │ │ ├── qfuser_v5.m │ │ │ ├── qfuser_v6.m │ │ │ ├── qfuser_v7.m │ │ │ └── scalibration │ │ │ │ ├── logsumexp_special.m │ │ │ │ ├── scal_fuser.m │ │ │ │ ├── scal_fuser_slow.m │ │ │ │ ├── scal_simple_fh.m │ │ │ │ ├── scalibration_fh.m │ │ │ │ └── scalibration_fragile_fh.m │ │ │ ├── test_binary_classifier.m │ │ │ └── train_binary_classifier.m │ │ ├── data │ │ ├── load_qual_files.m │ │ ├── load_score_files.m │ │ ├── log_error.m │ │ ├── log_info.m │ │ ├── log_warning.m │ │ ├── logprint.m │ │ ├── read_list.m │ │ ├── read_map.m │ │ ├── save_list.m │ │ └── sprintfmatrix.m │ │ ├── det │ │ ├── compute_roc.m │ │ ├── filter_roc.m │ │ ├── pavx.m │ │ ├── rocch.m │ │ └── rocchdet.m │ │ ├── manip │ │ ├── make_objective_function_from_name.m │ │ ├── map_mod_names.m │ │ ├── maplookup.m │ │ └── seg_qual_to_qual.m │ │ └── maths │ │ ├── logit.m │ │ ├── neglogsigmoid.m │ │ ├── probit.m │ │ └── sigmoid.m │ ├── create_BXE_calculator.m │ ├── create_HTPLDA_extractor.m │ ├── create_SGME_calculator.m │ ├── create_TPLDA.m │ ├── create_flat_partition_prior.m │ ├── create_partition_iterator.m │ ├── create_partition_posterior_calculator.m │ ├── create_plain_GME.m │ ├── create_pseudolikelihood_calculator.m │ ├── create_pseudolikelihood_calculator_old.m │ ├── create_scaled_GME.m │ ├── dsolve.m │ ├── equip_ME.m │ ├── example_8_1.m │ ├── labels2blocks.m │ ├── language_recognition │ ├── TLDIvector │ │ ├── create_diagonalized_C.m │ │ ├── experiment.m │ │ ├── getPosteriorNatParams.m │ │ ├── precomputeTT.m │ │ ├── score_TLDIvector.m │ │ ├── stats2ivectors.m │ │ └── train_TLDIvector.m │ ├── T_backend │ │ ├── McClachlan_Krishnan_The_EM_algorithm_and_extensions.pdf │ │ └── create_T_backend.m │ ├── augmentation │ │ ├── augment_i_vectors.m │ │ └── create_augmenting_backend.m │ └── synth_data │ │ ├── rand_fake_Dirichlet.m │ │ ├── rand_ivector.m │ │ └── randgamma.m │ ├── logBell.m │ ├── log_pseudo_likelihood.m │ ├── logsumexp.m │ ├── optimization │ ├── L_BFGS.m │ ├── minpack_cstep.m │ └── minpack_cvsrch.m │ ├── plain_GME_log_expectations.m │ ├── plotGaussian.m │ ├── plotL2dist.m │ ├── scaled_GME_precision.m │ ├── sumlogsoftmax.m │ ├── sumlogsumexp.m │ ├── synthdata │ ├── sample_HTPLDA_database.m │ ├── sample_HTnoise.m │ └── sample_speaker.m │ └── test │ ├── testBackprop.m │ ├── testBackprop_multi.m │ └── testBackprop_rs.m ├── plots ├── SGME_BXE_training_DET_plot.pdf ├── SGME__BXE_training_DCF_plot.pdf ├── SGME__BXE_training_DCF_plot_Train.pdf ├── SGME_cal_PsL_vs_BXE_1000rec.pdf ├── SGME_calibration.pdf ├── SGME_calibration_MCL_vs_PsL.pdf ├── SGME_calibration_PsL_1000recordings.pdf ├── SGME_nu_experiment_a.pdf ├── SGME_nu_experiment_b.pdf ├── SGME_training_DCF_plot.pdf ├── SGME_training_DET_plot.pdf └── Some_SGMEs.pdf └── theory ├── CRE3AB6.tmp ├── CRE3BC7.tmp ├── CRE781E.tmp ├── CRE9D5C.tmp ├── IEEEtran.bst ├── MMEM_5Dec2017.pdf ├── Meta-embeddings Introduction.pdf ├── SGME_BXE_training_DET_plot.pdf ├── SGME__BXE_training_DCF_plot.pdf ├── SGME__BXE_training_DCF_plot_Train.pdf ├── SGME_cal_PsL_vs_BXE_1000rec.pdf ├── SGME_calibration.pdf ├── SGME_calibration_MCL_vs_PsL.pdf ├── SGME_calibration_PsL_1000recordings.pdf ├── SGME_nu_experiment_a.pdf ├── SGME_nu_experiment_b.pdf ├── SGME_training_DCF_plot.pdf ├── SGME_training_DET_plot.pdf ├── Some_SGMEs.pdf ├── algebra_embedding-figure0.pdf ├── algebra_embedding-figure1.pdf ├── algebra_embedding-figure10.pdf ├── algebra_embedding-figure11.pdf ├── algebra_embedding-figure12.pdf ├── algebra_embedding-figure13.pdf ├── algebra_embedding-figure14.pdf ├── algebra_embedding-figure15.pdf ├── algebra_embedding-figure16.pdf ├── algebra_embedding-figure17.pdf ├── algebra_embedding-figure18.pdf ├── algebra_embedding-figure19.pdf ├── algebra_embedding-figure2.pdf ├── algebra_embedding-figure20.pdf ├── algebra_embedding-figure21.pdf ├── algebra_embedding-figure22.pdf ├── algebra_embedding-figure23.pdf ├── algebra_embedding-figure24.pdf ├── algebra_embedding-figure25.pdf ├── algebra_embedding-figure26.pdf ├── algebra_embedding-figure3.pdf ├── algebra_embedding-figure4.pdf ├── algebra_embedding-figure5.pdf ├── algebra_embedding-figure6.pdf ├── algebra_embedding-figure7.pdf ├── algebra_embedding-figure8.pdf ├── algebra_embedding-figure9.pdf ├── algebra_embedding.pdf ├── algebra_embedding.tex ├── composite_likelihood ├── cl4p.pdf └── cl4p.tex ├── embeddings.bib ├── lattice_of_partitions.png ├── lattice_of_partitions.svg ├── meta-embeddings_30Nov17_presentation.pdf └── readme.md /README.md: -------------------------------------------------------------------------------- 1 | # Meta-embeddings 2 | Meta-embeddings are a probabilistic generalization of embeddings in machine learning. This project started at the [2017 JHU HLTCOE SCALE Workshop](https://hltcoe.jhu.edu/research/scale/scale-2017). 3 | 4 | ## Theory 5 | For now, all the action is theoretical and happening via the collaborative writing of a document. See [theory](https://github.com/bsxfan/meta-embeddings/tree/master/theory) folder. 6 | 7 | ## Code 8 | There is already some MATLAB code to demonstrate Gaussian meta-embeddings. This code is now being used to generate some examples in the document. 9 | -------------------------------------------------------------------------------- /code/Andreas-Themos/utils_data.py: -------------------------------------------------------------------------------- 1 | from FaceDatasets import get_data_loader 2 | 3 | 4 | __author__ = "Andreas Nautsch, Themos Stafylakis" 5 | __maintainer__ = "Andreas Nautsch" 6 | __email__ = "andreas.nautsch@h-da.de" 7 | __status__ = "Development" 8 | __docformat__ = 'reStructuredText' 9 | __credits__ = ["Niko Brümmer, Adrian Bulat"] 10 | 11 | 12 | def data_loader(database_dir, shuffle=True, train_add_noise=False): 13 | # TODO still Face specific 14 | if not isinstance(database_dir, str): # isinstance(database_dir, DataLoader) or not is : 15 | dataloader = database_dir 16 | else: 17 | dataloader = get_data_loader(database_dir, shuffle=shuffle, train_add_noise=train_add_noise) 18 | return dataloader -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/MLNDAobj.m: -------------------------------------------------------------------------------- 1 | function [y,back] = MLNDAobj(T,labels,F,W,fi,params,nu) 2 | 3 | ht = exist('nu','var') && ~isempty(nu) && ~isinf(nu); 4 | 5 | [R,logdetJ,back2] = fi(params,T); 6 | 7 | 8 | if ht 9 | [llh,back1] = htplda_llh(R,labels,F,W,nu); 10 | else 11 | [llh,back1] = splda_llh(R,labels,F,W); 12 | end 13 | 14 | 15 | y = logdetJ - llh; 16 | 17 | back = @back_this; 18 | 19 | function dparams = back_this(dy) 20 | dlogdetJ = dy; 21 | dR = back1(-dy); 22 | dparams = back2(dR,dlogdetJ); 23 | end 24 | 25 | 26 | end -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/mmd/log_gauss_norm.m: -------------------------------------------------------------------------------- 1 | function [y,back] = log_gauss_norm(B,a) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | [logd,mu,back1] = logdet_solveLU(B,a); 9 | y = (logd -mu.'*a)/2; 10 | 11 | back = @back_this; 12 | 13 | function [dB,da] = back_this(dy) 14 | dlogd = dy/2; 15 | da = (-dy/2)*mu; 16 | dmu = (-dy/2)*a; 17 | [dB,da1] = back1(dlogd,dmu); 18 | da = da + da1; 19 | end 20 | 21 | end 22 | 23 | function test_this() 24 | 25 | dim = 5; 26 | B = randn(dim); 27 | a = rand(dim,1); 28 | 29 | testBackprop(@log_gauss_norm,{B,a},{1,1}); 30 | 31 | 32 | end 33 | -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/mmd/logdet_solveLU.m: -------------------------------------------------------------------------------- 1 | function [y,mu,back] = logdet_solveLU(B,a) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | [L,U] = lu(B); 9 | y = sum(log(diag(U).^2))/2; %logdet 10 | mu = U\(L\a); %solve 11 | 12 | back = @back_this; 13 | 14 | function [dB,da] = back_this(dy,dmu) 15 | dB = dy*(L.'\inv(U.')); 16 | da = L.'\(U.'\dmu); 17 | dB = dB - da*mu.'; 18 | end 19 | 20 | 21 | end 22 | 23 | function test_this() 24 | 25 | dim = 5; 26 | B = randn(dim); 27 | a = randn(dim,1); 28 | 29 | testBackprop_multi(@logdet_solveLU,2,{B,a}); 30 | 31 | end -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/mmd/rkhs_inner_prod.m: -------------------------------------------------------------------------------- 1 | function y = rkhs_inner_prod(sigma,B1,a1,B2,a2) 2 | 3 | dim = length(a1); 4 | I = eye(dim); 5 | Bconv = (I+sigma*B1)\B1; % inv(sigmaI + inv(B1)) 6 | aconv = (I+sigma*B1)\a1; % Bconv*(B1\a) 7 | 8 | y = gauss_prod_int(aconv,Bconv,a2,B2); 9 | 10 | end 11 | 12 | function y = log_gauss_norm(B,a) 13 | [logd,mu,back] = logdet_solveLU(B,a); 14 | y = (logd-mu.'*a)/2; 15 | 16 | end 17 | 18 | 19 | function y = gauss_prod_int(a1,B1,a2,B2) 20 | 21 | y = exp(log_gauss_norm(B1,a1) + log_gauss_norm(B2,a2) ... 22 | - log_gauss_norm(B1+B2,a1+a2) ); 23 | 24 | 25 | end -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/mmd/rkhs_proj_onto_I0.m: -------------------------------------------------------------------------------- 1 | function [y,back] = rkhs_proj_onto_I0(A,b,B) 2 | % RKHS inner products of multivariate Gaussians onto standard normal. The 3 | % RKHS kernel is K(x,y) = ND(x|y,sigma I). The first order natural 4 | % parameters of the Gaussians are in the columns of A. The precisions are 5 | % proportional to the fixed B, with scaling contants in the vector b. 6 | 7 | 8 | 9 | 10 | end -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/param_adaptation/LinvSR.m: -------------------------------------------------------------------------------- 1 | function [Y,back] = LinvSR(L,S,R) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | 9 | Z = S\R; 10 | Y = L*Z; 11 | 12 | back = @back_this; 13 | 14 | function [dL,dS,dR] = back_this(dY) 15 | 16 | % Y = L*Z 17 | dL = dY*Z.'; 18 | dZ = L.'*dY; 19 | 20 | % Z = S\R; 21 | dR = S.'\dZ; 22 | dS = -dR*Z.'; 23 | end 24 | 25 | 26 | end 27 | 28 | 29 | 30 | 31 | function test_this() 32 | 33 | m = 3; 34 | n = 4; 35 | 36 | L = randn(m,n); 37 | R = randn(n,m); 38 | S = randn(n,n); 39 | 40 | fprintf('test slow derivatives:\n'); 41 | testBackprop(@LinvSR,{L,S,R}); 42 | 43 | 44 | 45 | end 46 | 47 | -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/param_adaptation/logdetLU.m: -------------------------------------------------------------------------------- 1 | function [y,back] = logdetLU(M) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | [L,U] = lu(M); 9 | y = sum(log(diag(U).^2))/2; 10 | 11 | back = @back_this; 12 | 13 | function dM = back_this(dy) 14 | %dM = dy*(inv(U)/L).'; 15 | dM = dy*(L.'\inv(U.')); 16 | end 17 | 18 | 19 | end 20 | 21 | function test_this() 22 | 23 | dim = 5; 24 | M = randn(dim); 25 | 26 | testBackprop(@logdetLU,M); 27 | 28 | end -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/param_adaptation/matinv.m: -------------------------------------------------------------------------------- 1 | function [Y,back] = matinv(S) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | 9 | Y = inv(S); 10 | 11 | back = @back_this; 12 | 13 | function dS = back_this(dY) 14 | 15 | dS = -Y.'*dY*Y.'; 16 | end 17 | 18 | 19 | end 20 | 21 | 22 | 23 | 24 | function test_this() 25 | 26 | n = 4; 27 | 28 | S = randn(n,n); 29 | 30 | testBackprop(@matinv,S); 31 | 32 | 33 | 34 | end 35 | 36 | -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/param_adaptation/unpack_SPLDA_adaptation_params.m: -------------------------------------------------------------------------------- 1 | function [Fcols,Fscal,Cfac] = unpack_SPLDA_adaptation_params(params,dim,Frank,num_new_Fcols,W_adj_rank) 2 | 3 | at = 0; 4 | 5 | sz = dim*num_new_Fcols; 6 | Fcols = reshape(params(at+(1:sz)),dim,num_new_Fcols); 7 | at = at + sz; 8 | 9 | sz = Frank; 10 | Fscal = reshape(params(at+(1:sz)),1,Frank); 11 | at = at + sz; 12 | 13 | sz = dim*W_adj_rank; 14 | Cfac = reshape(params(at+(1:sz)),dim,W_adj_rank); 15 | at = at + sz; 16 | 17 | assert( at == length(params) ); 18 | 19 | 20 | end -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/MLNDA_SRE18/sample_HTnoise.m: -------------------------------------------------------------------------------- 1 | function X = sample_HTnoise(nu,dim,n,W) 2 | % Sample n heavy-tailed dim-dimensional variables. (Only for integer nu.) 3 | % 4 | % Inputs: 5 | % nu: integer nu >=1, degrees of freedom of resulting t-distribution 6 | % n: number of samples 7 | % W: precision matrix for T-distribution 8 | % 9 | % Output: 10 | % X: dim-by-n samples 11 | 12 | cholW = chol(W); 13 | if isinf(nu) 14 | precisions = ones(1,n); 15 | else 16 | precisions = mean(randn(nu,n).^2,1); 17 | end 18 | std = 1./sqrt(precisions); 19 | X = cholW\bsxfun(@times,std,randn(dim,n)); 20 | end 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/SRE18/fusion and calibration/llr_vs_score_plot.m: -------------------------------------------------------------------------------- 1 | function llr_vs_score_plot(tar_scores,nontar_scores,tar_llrs,nontar_llrs) 2 | % Plots a comparison of your calibration effort vs PAV (non-parametric, monotonic) 3 | % Inputs: 4 | % tar_scores,nontar_scores: raw (uncalibrated) scores 5 | % tar_llrs,nontar_llrs: your effort to calibrate these scores to LLRs 6 | 7 | 8 | 9 | [tar_pav,nontar_pav] = opt_loglr(tar_scores,nontar_scores); 10 | 11 | 12 | scores = [tar_scores(:)',nontar_scores(:)']; 13 | llrs = [tar_llrs(:)',nontar_llrs(:)']; 14 | pav_scores = [tar_pav(:)',nontar_pav(:)']; 15 | 16 | plot(scores,pav_scores,'g',scores,llrs,'r'); 17 | legend('pav','your effort'); 18 | xlabel('score'); 19 | ylabel('llr'); 20 | title('PAV vs your calibration'); 21 | 22 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/Bell.m: -------------------------------------------------------------------------------- 1 | function [b B] = Bell(n) 2 | % b = Bell(N) 3 | % N integer 4 | % Compute the Bell's number. It is the number of all possible partitions 5 | % of the set {1:N}. 6 | % [b B] = Bell(N) returns in column vector B all Bell's numbers from 1 to N 7 | % 8 | % Author: Bruno Luong 9 | % History 10 | % Original: 17-May-2009 11 | % Last update: 18-May-2009, cosmetic changes 12 | 13 | n=double(n); 14 | if n==0 15 | b = 1; 16 | B = zeros(0,1); 17 | return 18 | end 19 | A = zeros(n); 20 | A(1,1) = 1; 21 | for i=2:n 22 | A(i,1) = A(i-1,i-1); 23 | for j=2:n 24 | A(i,j) = A(i,j-1) + A(i-1,j-1); 25 | end 26 | end 27 | b = A(n,n); 28 | if nargout>=2 29 | B = diag(A); 30 | end 31 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/CRP/K1.table: -------------------------------------------------------------------------------- 1 | 1 0.03 2 | 2 0.034 3 | 3 0.033 4 | 4 0.046 5 | 5 0.054 6 | 6 0.051 7 | 7 0.046 8 | 8 0.06 9 | 9 0.054 10 | 10 0.065 11 | 11 0.071 12 | 12 0.074 13 | 13 0.094 14 | 14 0.084 15 | 15 0.075 16 | 16 0.051 17 | 17 0.043 18 | 18 0.024 19 | 19 0.007 20 | 20 0.004 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/CRP/K2.table: -------------------------------------------------------------------------------- 1 | 1 0 2 | 2 0 3 | 3 0 4 | 4 0.003 5 | 5 0.01 6 | 6 0.023 7 | 7 0.083 8 | 8 0.117 9 | 9 0.172 10 | 10 0.196 11 | 11 0.176 12 | 12 0.116 13 | 13 0.05 14 | 14 0.043 15 | 15 0.009 16 | 16 0.002 17 | 17 0 18 | 18 0 19 | 19 0 20 | 20 0 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/CRP/randgumbel.m: -------------------------------------------------------------------------------- 1 | function r = randgumbel(m,n) 2 | 3 | r = -log(-log(rand(m,n))); 4 | 5 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/MLNDA/LinvSR.m: -------------------------------------------------------------------------------- 1 | function [Y,back] = LinvSR(L,S,R) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | 9 | Z = S\R; 10 | Y = L*Z; 11 | 12 | back = @back_this; 13 | 14 | function [dL,dS,dR] = back_this(dY) 15 | 16 | % Y = L*Z 17 | dL = dY*Z.'; 18 | dZ = L.'*dY; 19 | 20 | % Z = S\R; 21 | dR = S.'\dZ; 22 | dS = -dR*Z.'; 23 | end 24 | 25 | 26 | end 27 | 28 | 29 | 30 | 31 | function test_this() 32 | 33 | m = 3; 34 | n = 4; 35 | 36 | L = randn(m,n); 37 | R = randn(n,m); 38 | S = randn(n,n); 39 | 40 | fprintf('test slow derivatives:\n'); 41 | testBackprop(@LinvSR,{L,S,R}); 42 | 43 | 44 | 45 | end 46 | 47 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/MLNDA/MLNDAobj.m: -------------------------------------------------------------------------------- 1 | function [y,back] = MLNDAobj(T,labels,F,W,fi,params) 2 | 3 | [R,logdetJ,back2] = fi(params,T); 4 | [llh,back1] = splda_llh(R,labels,F,W); 5 | y = logdetJ - llh; 6 | 7 | back = @back_this; 8 | 9 | function dparams = back_this(dy) 10 | dlogdetJ = dy; 11 | dR = back1(-dy); 12 | dparams = back2(dR,dlogdetJ); 13 | end 14 | 15 | 16 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/MLNDA/create_scalTrans.m: -------------------------------------------------------------------------------- 1 | function [f,fi] = create_scalTrans() 2 | 3 | if nargout==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | 9 | f = @(scal,R) scal*R; 10 | 11 | fi = @fi_this; 12 | 13 | function [R,logdetJ,back] = fi_this(scal,T) 14 | [dim,N] = size(T); 15 | R = T/scal; 16 | logdetJ = (N*dim/2)*log(scal^2); 17 | back = @back_this; 18 | 19 | 20 | function dscal = back_this(dR,dlogdetJ) 21 | dscal = N*dim*dlogdetJ/scal; 22 | dscal = dscal - (R(:).'*dR(:))/scal; 23 | end 24 | 25 | end 26 | 27 | end 28 | 29 | 30 | function test_this() 31 | 32 | [f,fi] = create_scalTrans(); 33 | R = randn(3,5); 34 | ff = @(scal) fi(scal,R); 35 | scal = pi; 36 | 37 | testBackprop_multi(ff,2,{scal}); 38 | 39 | 40 | end 41 | 42 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/MLNDA/diag2full.m: -------------------------------------------------------------------------------- 1 | function [M,back] = diag2full(d) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | dim = length(d); 9 | 10 | M = sparse(1:dim,1:dim,d,dim,dim); 11 | back = @back_this; 12 | 13 | function [dd] = back_this(dM) 14 | dd = diag(dM); 15 | end 16 | 17 | 18 | end 19 | 20 | function test_this() 21 | 22 | d = randn(5,1); 23 | testBackprop(@diag2full,{d}); 24 | 25 | 26 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/MLNDA/logdetLU.m: -------------------------------------------------------------------------------- 1 | function [y,back] = logdetLU(M) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | [L,U] = lu(M); 9 | y = sum(log(diag(U).^2))/2; 10 | 11 | back = @back_this; 12 | 13 | function dM = back_this(dy) 14 | %dM = dy*(inv(U)/L).'; 15 | dM = dy*(L.'\inv(U.')); 16 | end 17 | 18 | 19 | end 20 | 21 | function test_this() 22 | 23 | dim = 5; 24 | M = randn(dim); 25 | 26 | testBackprop(@logdetLU,M); 27 | 28 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/MLNDA/matmul.m: -------------------------------------------------------------------------------- 1 | function [M,back] = matmul(A,B) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | M = A*B; 9 | back = @back_this; 10 | 11 | function [dA,dB] = back_this(dM) 12 | dA = dM*B.'; 13 | dB = A.'*dM; 14 | end 15 | 16 | 17 | end 18 | 19 | function test_this() 20 | 21 | m = 2; 22 | n = 3; 23 | k = 4; 24 | A = randn(m,k); 25 | B = randn(k,n); 26 | 27 | testBackprop(@matmul,{A,B}); 28 | 29 | 30 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/MLNDA/smvn_llh.m: -------------------------------------------------------------------------------- 1 | function [y,back] = smvn_llh(R) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | y = (-0.5)*R(:).'*R(:); 9 | back = @(dy) (-dy)*R; 10 | 11 | end 12 | 13 | function test_this() 14 | 15 | R = randn(3,5); 16 | testBackprop(@smvn_llh,{R}); 17 | 18 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/Orlov2002_partitions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/Orlov2002_partitions.pdf -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/ParPLDA/SPLDA_equip_with_diagble_extractor.m: -------------------------------------------------------------------------------- 1 | function model = SPLDA_equip_with_diagble_extractor(model) 2 | % Equip SPLDA model with a function handles for extracting diagonalizable 3 | % meta-embeddings 4 | 5 | V = model.V; 6 | mu = model.mu; 7 | W = model.W; 8 | 9 | VW = V.'*W; 10 | dP = create_diagonalized_precision(VW*V); 11 | 12 | 13 | model.extractDME = @extractDME; 14 | 15 | 16 | 17 | function me = extractDME(X) 18 | me.dP = dP; 19 | me.F = VW*bsxfun(@minus,X,mu); 20 | me.n = ones(1,size(X,2)); 21 | end 22 | 23 | 24 | 25 | 26 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/ParPLDA/SPLDA_equip_with_extractor.m: -------------------------------------------------------------------------------- 1 | function model = SPLDA_equip_with_extractor(model) 2 | % Equip SPLDA model with function handles for runtime functionality 3 | 4 | V = model.V; 5 | mu = model.mu; 6 | W = model.W; 7 | 8 | VW = V.'*W; 9 | VWV = VW*V; 10 | 11 | 12 | model.extractME = @extractME; 13 | 14 | 15 | 16 | function me = extractME(X) 17 | me.P = VWV; 18 | me.F = VW*bsxfun(@minus,X,mu); 19 | end 20 | 21 | 22 | 23 | 24 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/approx_log_Bell.m: -------------------------------------------------------------------------------- 1 | function [logB,err] = approx_log_Bell(n) 2 | 3 | logn = log(n); 4 | loglogn = log(logn); 5 | 6 | logB = n.*( logn -loglogn -1 + (1+loglogn)./logn + 0.5*(loglogn./logn).^2 ); 7 | err = n.*loglogn./logn.^2; 8 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/binary_mixture_llh.m: -------------------------------------------------------------------------------- 1 | function llh = binary_mixture_llh(llh1,llh2,logitp) 2 | logp = -log1p(exp(-logitp)); 3 | logp1 = -log1p(exp(logitp)); 4 | llh = logsumexp([logp + llh1; logp1 + llh2]); 5 | 6 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Det_Plot/add_legend_entry.m: -------------------------------------------------------------------------------- 1 | function add_legend_entry(plot_obj,lh,legend_string,append_name) 2 | % Places a (curve handle, legend string) pair in a list for when 3 | % display_legend is called. 4 | % Inputs: 5 | % lh: A curve handle. 6 | % legend_string: The string to be displayed in the legend for the 7 | % curve corresponding to lh. 8 | % append_name: A boolean indicating whether to prepend the system 9 | % name (set in 'set_system') to the 'legend_string'. 10 | 11 | if ~strcmp(legend_string,'') 12 | plot_obj.handles_vec = [plot_obj.handles_vec lh]; 13 | if exist('append_name','var') && append_name 14 | plot_obj.legend_strings = {plot_obj.legend_strings{:},[plot_obj.sys_name ' ' legend_string]}; 15 | else 16 | plot_obj.legend_strings = {plot_obj.legend_strings{:},legend_string}; 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Det_Plot/display_legend.m: -------------------------------------------------------------------------------- 1 | function display_legend(plot_obj) 2 | % Displays the legend on the plot. Call this function after all 3 | % curves and points have been plotted. The only function that 4 | % should be called after this one is the one for saving the plot. 5 | % Legend entries for curves are stored with add_legend_entry. 6 | 7 | if length(plot_obj.legend_strings) > 0 8 | figure(plot_obj.fh) 9 | legend(plot_obj.handles_vec,plot_obj.legend_strings) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Det_Plot/plot_DR30_both.m: -------------------------------------------------------------------------------- 1 | function plot_DR30_both(plot_obj,plot_args_fa,plot_args_miss) 2 | % Plots two lines indicating Doddington's Rule of 30 points: one 3 | % for false alarms and one for misses. See the documentation of 4 | % plot_DR30_fa and plot_DR30_miss for details. 5 | % Inputs: 6 | % plot_args_fa: A cell array of arguments to be passed to 'plot' that control 7 | % the appearance of the DR30_fa point. See Matlab's help on 'plot' for information. 8 | % plot_args_miss: A cell array of arguments to be passed to 'plot' that control 9 | % the appearance of the DR30_miss point. See Matlab's help on 'plot' for information. 10 | 11 | plot_obj.plot_DR30_fa(plot_args_fa,'pfa DR30'); 12 | plot_obj.plot_DR30_miss(plot_args_miss,'pmiss DR30'); 13 | 14 | end 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Det_Plot/plot_det_from_roc.m: -------------------------------------------------------------------------------- 1 | function plot_det_from_roc(plot_obj,Pmiss,Pfa,plot_args,legend_string) 2 | % Plots a DET curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to plot that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | 8 | if ischar(plot_args) 9 | plot_args = {plot_args}; 10 | end 11 | 12 | figure(plot_obj.fh); 13 | 14 | 15 | x = probit(Pfa); 16 | y = probit(Pmiss); 17 | assert(iscell(plot_args)) 18 | lh = plot(x,y,plot_args{:}); 19 | 20 | if exist('legend_string','var') && ~isempty(legend_string) 21 | assert(ischar(legend_string)) 22 | plot_obj.add_legend_entry(lh,legend_string,true); 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Det_Plot/prepare_plot.m: -------------------------------------------------------------------------------- 1 | function prepare_plot(plot_obj) 2 | % Creates a new figure, switches hold on, embellishes and returns handle. 3 | 4 | plot_obj.fh = figure(); 5 | hold on 6 | 7 | axis('square'); 8 | 9 | set(gca, 'xlim', probit(plot_obj.pfa_limits)); 10 | set(gca, 'xtick', probit(plot_obj.xticks)); 11 | set(gca, 'xticklabel', plot_obj.xticklabels); 12 | set(gca, 'xgrid', 'on'); 13 | xlabel('False Alarm probability (in %)'); 14 | 15 | set(gca, 'ylim', probit(plot_obj.pmiss_limits)); 16 | set(gca, 'ytick', probit(plot_obj.yticks)); 17 | set(gca, 'yticklabel', plot_obj.yticklabels); 18 | set(gca, 'ygrid', 'on') 19 | ylabel('Miss probability (in %)') 20 | 21 | end 22 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Det_Plot/save_as_pdf.m: -------------------------------------------------------------------------------- 1 | function save_as_pdf(plot_obj,outfilename) 2 | % Save the DET plot in a PDF file 3 | % Inputs: 4 | % outfilename: The name of the PDF file to save the plot in. 5 | 6 | assert(ischar(outfilename)) 7 | 8 | saveas(plot_obj.fh,outfilename,'pdf'); 9 | end 10 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Id_Map/merge.m: -------------------------------------------------------------------------------- 1 | function idmap = merge(idmap1,idmap2) 2 | % Merges two Id_Map objects. idmap2 is appended to idmap1. 3 | % Inputs: 4 | % idmap1: An Id_Map object. 5 | % idmap2: Another Id_Map object. 6 | % Outputs: 7 | % idmap: An Id_Map object that contains the information from the two 8 | % input Id_Maps. 9 | 10 | assert(nargin==2) 11 | assert(isa(idmap1,'Id_Map')) 12 | assert(isa(idmap2,'Id_Map')) 13 | assert(idmap1.validate()) 14 | assert(idmap2.validate()) 15 | 16 | if ~isempty(intersect(idmap1.leftids,idmap2.leftids)) || ~isempty(intersect(idmap1.rightids,idmap2.rightids)) 17 | log_warning('idmaps being merged share ids.\n') 18 | end 19 | 20 | idmap = Id_Map(); 21 | idmap.leftids = {idmap1.leftids{:}, idmap2.leftids{:}}'; 22 | idmap.rightids = {idmap1.rightids{:}, idmap2.rightids{:}}'; 23 | 24 | assert(idmap.validate(false)) 25 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Id_Map/read_mat.m: -------------------------------------------------------------------------------- 1 | function idmap = read_mat(infilename) 2 | % Reads a struct from a mat file and constructs an Id_Map object. 3 | % Inputs: 4 | % infilename: The name for the mat file to read. 5 | % Outputs: 6 | % idmap: An Id_Map object created from the information in the mat 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'idmap'); 13 | idmap = Id_Map(idmap); 14 | 15 | assert(idmap.validate()) 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Id_Map/read_txt.m: -------------------------------------------------------------------------------- 1 | function idmap = read_txt(infilename) 2 | % Reads ids from a text file and constructs an Id_Map object. 3 | % Inputs: 4 | % infilename: The name for the text file to read. 5 | % Outputs: 6 | % idmap: An Id_Map object created from the information in the text 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | fid = fopen(infilename); 13 | lines = textscan(fid,'%s%s'); 14 | fclose(fid); 15 | 16 | idmap = Id_Map(); 17 | idmap.leftids = lines{1}; 18 | idmap.rightids = lines{2}; 19 | 20 | assert(idmap.validate()) 21 | 22 | end 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Id_Map/save_hdf5.m: -------------------------------------------------------------------------------- 1 | function save_hdf5(idmap,outfilename) 2 | % Saves the Id_Map object to an hdf5 file. 3 | % Inputs: 4 | % idmap: The Id_Map object to save. 5 | % outfilename: The name of the output hdf5 file. 6 | 7 | assert(nargin==2) 8 | assert(isa(idmap,'Id_Map')) 9 | assert(isa(outfilename,'char')) 10 | assert(idmap.validate(false)) 11 | 12 | hdf5write(outfilename,'/left_ids',idmap.leftids,'V71Dimensions',true); 13 | hdf5write(outfilename,'/right_ids',idmap.rightids,'V71Dimensions',true,'WriteMode','append'); 14 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Id_Map/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(idmap,outfilename) 2 | % Saves the Id_Map object in a mat file. 3 | % Inputs: 4 | % idmap: The Id_Map object to save. 5 | % outfilename: The name of the output mat file. 6 | 7 | assert(nargin==2) 8 | assert(isa(idmap,'Id_Map')) 9 | assert(isa(outfilename,'char')) 10 | assert(idmap.validate(false)) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | idmap = struct(idmap); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'idmap'); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Id_Map/save_txt.m: -------------------------------------------------------------------------------- 1 | function save_txt(idmap,outfilename) 2 | % Saves the Id_Map to a text file. 3 | % Inputs: 4 | % idmap: An object of type Id_Map. 5 | % outfilename: The name for the output text file. 6 | 7 | assert(nargin==2) 8 | assert(isa(idmap,'Id_Map')) 9 | assert(isa(outfilename,'char')) 10 | assert(idmap.validate(false)) 11 | 12 | outfile = fopen(outfilename,'w'); 13 | 14 | numentries = length(idmap.leftids); 15 | for ii=1:numentries 16 | leftid = idmap.leftids{ii}; 17 | rightid = idmap.rightids{ii}; 18 | fprintf(outfile,'%s %s\n',leftid,rightid); 19 | end 20 | 21 | fclose(outfile); 22 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Key/read_mat.m: -------------------------------------------------------------------------------- 1 | function key = read_mat(infilename) 2 | % Reads a struct from a mat file and constructs a Key object. 3 | % Inputs: 4 | % infilename: The name for the mat file to read. 5 | % Outputs: 6 | % key: A Key object created from the information in the mat 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'key'); 13 | key = Key(key); 14 | 15 | assert(key.validate()) 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Key/save.m: -------------------------------------------------------------------------------- 1 | function save(key,outfilename) 2 | % Saves a Key object to a file. The file type is determined by 3 | % the extension. 4 | % Inputs: 5 | % key: The Key object to be saved. 6 | % outfilename: The name for the output file. 7 | 8 | assert(nargin==2) 9 | assert(isa(key,'Key')) 10 | assert(isa(outfilename,'char')) 11 | assert(key.validate()) 12 | 13 | dotpos = strfind(outfilename,'.'); 14 | assert(~isempty(dotpos)) 15 | extension = outfilename(dotpos(end)+1:end); 16 | assert(~isempty(extension)) 17 | 18 | if strcmp(extension,'hdf5') || strcmp(extension,'h5') 19 | key.save_hdf5(outfilename); 20 | elseif strcmp(extension,'mat') 21 | key.save_mat(outfilename); 22 | elseif strcmp(extension,'txt') 23 | key.save_txt(outfilename); 24 | else 25 | error('Unknown extension "%s"\n',extension) 26 | end 27 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Key/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(key,outfilename) 2 | % Saves the Key to a mat file. 3 | % Inputs: 4 | % key: An object of type Key. 5 | % outfilename: The name for the output mat file. 6 | 7 | assert(nargin==2) 8 | assert(isa(key,'Key')) 9 | assert(isa(outfilename,'char')) 10 | assert(key.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | key = struct(key); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'key'); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Key/to_ndx.m: -------------------------------------------------------------------------------- 1 | function ndx = to_ndx(key) 2 | % Returns an Ndx based on the Key. 3 | % Inputs: 4 | % key: An object of type Key. 5 | % Outputs: 6 | % ndx: An object of type Ndx. 7 | 8 | assert(nargin==1) 9 | assert(isa(key,'Key')) 10 | assert(key.validate()) 11 | 12 | ndx = Ndx(); 13 | ndx.modelset = key.modelset; 14 | ndx.segset = key.segset; 15 | ndx.trialmask = key.tar | key.non; 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Key/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(key) 2 | % Checks that an object of type Key obeys certain rules that 3 | % must always be true. 4 | % Inputs: 5 | % key: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(key,'Key')) 11 | 12 | ok = iscell(key.modelset); 13 | ok = ok && iscell(key.segset); 14 | 15 | nummods = length(key.modelset); 16 | numsegs = length(key.segset); 17 | 18 | ok = ok && (size(key.tar,1)==nummods); 19 | ok = ok && (size(key.tar,2)==numsegs); 20 | 21 | ok = ok && (size(key.non,1)==nummods); 22 | ok = ok && (size(key.non,2)==numsegs); 23 | 24 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/add_stderr.m: -------------------------------------------------------------------------------- 1 | function add_stderr(logger,level) 2 | % After a call to this method, log messages with the appropriate 3 | % level setting will be written to standard error (as well as other 4 | % log files). 5 | % Inputs: 6 | % level: Indicates which log messages should go to standard error. 7 | % See the class definition file for a list of levels. Levels 8 | % can be combined by bit oring them. 9 | 10 | if ~isempty(find(logger.fidlist==2)) 11 | fprintf('Warning: stderr is already in the list and will not be added.\n'); 12 | else 13 | logger.fidlist = [logger.fidlist, 2]; 14 | if ~exist('level','var') 15 | level = Logger.All; 16 | else 17 | assert(level >= 0) 18 | end 19 | logger.fidlevels = [logger.fidlevels, level]; 20 | end 21 | 22 | assert(logger.validate()) 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/add_stdout.m: -------------------------------------------------------------------------------- 1 | function add_stdout(logger,level) 2 | % After a call to this method, log messages with the appropriate 3 | % level setting will be written to standard out (as well as other 4 | % log files). 5 | % Inputs: 6 | % level: Indicates which log messages should go to standard out. 7 | % See the class definition file for a list of levels. Levels 8 | % can be combined by bit oring them. 9 | 10 | if ~isempty(find(logger.fidlist==1)) 11 | fprintf('Warning: stdin is already in the list and will not be added.\n'); 12 | else 13 | logger.fidlist = [logger.fidlist, 1]; 14 | if ~exist('level','var') 15 | level = Logger.All; 16 | else 17 | assert(level >= 0) 18 | end 19 | logger.fidlevels = [logger.fidlevels, level]; 20 | end 21 | 22 | assert(logger.validate()) 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/clear.m: -------------------------------------------------------------------------------- 1 | function clear(logger) 2 | % Removes all logfiles from the list. Files that were added using 3 | % their name (i.e. not their fid) are closed. 4 | 5 | logger.fidlist = []; 6 | logger.fidlevels = []; 7 | for ii=1:length(logger.filenamefids) 8 | fclose(logger.filenamefids(ii)); 9 | end 10 | logger.filenamelist = {}; 11 | logger.filenamefids = []; 12 | logger.filenamelevels = []; 13 | 14 | assert(logger.validate()) 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/log.m: -------------------------------------------------------------------------------- 1 | function log(logger,level,message,varargin) 2 | % Writes a message to all log files (and possibly standard out and 3 | % standard error). 4 | % Inputs: 5 | % level: The logging level. See the constants defined in the 6 | % class header. Several constants can be combined by bit oring 7 | % them. 8 | 9 | assert(logger.validate()) 10 | 11 | for ii=1:length(logger.fidlist) 12 | if bitand(logger.fidlevels(ii),level) 13 | fprintf(logger.fidlist(ii),message,varargin{:}); 14 | end 15 | end 16 | for ii=1:length(logger.filenamefids) 17 | if bitand(logger.filenamelevels(ii),level) 18 | fprintf(logger.filenamefids(ii),message,varargin{:}); 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/rm_fid.m: -------------------------------------------------------------------------------- 1 | function rm_fid(logger,fid) 2 | % Stops the logger writing to the given file. The file is not 3 | % closed (that is the responsibility of the user code). 4 | % Inputs: 5 | % fid: A file id of an open log file. 6 | 7 | f = find(logger.fidlist==fid); 8 | if isempty(f) 9 | fprintf('Warning: fid: %d is not in the list and can not be removed.\n',fid); 10 | else 11 | logger.fidlist(f) = []; 12 | logger.fidlevels(f) = []; 13 | end 14 | 15 | assert(logger.validate()) 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/rm_filename.m: -------------------------------------------------------------------------------- 1 | function rm_filename(logger,fname) 2 | % Stops the logger writing to the named file and closes the file. 3 | % Inputs: 4 | % fname: The name of the (open) log file. 5 | 6 | f = find(ismember(logger.filenamelist,fname)==1); 7 | if isempty(f) 8 | fprintf('Warning: filename "%s" is not in the list and can not be removed.\n',fname); 9 | else 10 | fid = logger.filenamefids(f); 11 | fclose(fid); 12 | logger.filenamelist(f) = []; 13 | logger.filenamefids(f) = []; 14 | logger.filenamelevels(f) = []; 15 | end 16 | 17 | assert(logger.validate()) 18 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/rm_stderr.m: -------------------------------------------------------------------------------- 1 | function rm_stderr(logger) 2 | % Stops the logger writing to standard error. 3 | 4 | f = find(logger.fidlist==2); 5 | if isempty(f) 6 | fprintf('Warning: stderr is not in the list and can not be removed.\n'); 7 | else 8 | logger.fidlist(f) = []; 9 | logger.fidlevels(f) = []; 10 | end 11 | 12 | assert(logger.validate()) 13 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/rm_stdout.m: -------------------------------------------------------------------------------- 1 | function rm_stdout(logger) 2 | % Stops the logger writing to the standard output. 3 | 4 | f = find(logger.fidlist==1); 5 | if isempty(f) 6 | fprintf('Warning: stdin is not in the list and can not be removed.\n'); 7 | else 8 | logger.fidlist(f) = []; 9 | logger.fidlevels(f) = []; 10 | end 11 | 12 | assert(logger.validate()) 13 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Logger/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(logger) 2 | % Checks that an object of type Logger obeys certain rules that 3 | % must always be true. 4 | % Inputs: 5 | % logger: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(logger,'Logger')) 11 | 12 | ok = length(logger.fidlist)==length(logger.fidlevels); 13 | ok = ok && length(logger.filenamelist)==length(logger.filenamefids); 14 | ok = ok && length(logger.filenamelist)==length(logger.filenamelevels); 15 | ok = ok && all(logger.fidlist > 0); 16 | ok = ok && all(logger.filenamefids > 0); 17 | ok = ok && all(logger.fidlevels >= 0); 18 | ok = ok && all(logger.fidlevels < 256); 19 | ok = ok && all(logger.filenamelevels >= 0); 20 | ok = ok && all(logger.filenamelevels < 256); 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Ndx/read_mat.m: -------------------------------------------------------------------------------- 1 | function ndx = read_mat(infilename) 2 | % Reads a struct from a mat file and constructs an Ndx object. 3 | % Inputs: 4 | % infilename: The name for the mat file to read. 5 | % Outputs: 6 | % ndx: An Ndx object created from the information in the mat 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'ndx'); 13 | ndx = Ndx(ndx); 14 | 15 | assert(ndx.validate()) 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Ndx/save.m: -------------------------------------------------------------------------------- 1 | function save(ndx,outfilename) 2 | % Saves an Ndx object to a file. The file type is determined by 3 | % the extension. 4 | % Inputs: 5 | % ndx: The Ndx object to be saved. 6 | % outfilename: The name for the output file. 7 | 8 | assert(nargin==2) 9 | assert(isa(ndx,'Ndx')) 10 | assert(isa(outfilename,'char')) 11 | assert(ndx.validate()) 12 | 13 | dotpos = strfind(outfilename,'.'); 14 | assert(~isempty(dotpos)) 15 | extension = outfilename(dotpos(end)+1:end); 16 | assert(~isempty(extension)) 17 | 18 | if strcmp(extension,'hdf5') || strcmp(extension,'h5') 19 | ndx.save_hdf5(outfilename); 20 | elseif strcmp(extension,'mat') 21 | ndx.save_mat(outfilename); 22 | elseif strcmp(extension,'txt') 23 | ndx.save_txt(outfilename); 24 | else 25 | error('Unknown extension "%s"\n',extension) 26 | end 27 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Ndx/save_hdf5.m: -------------------------------------------------------------------------------- 1 | function save_hdf5(ndx,outfilename) 2 | % Saves the Ndx object in an hdf5 file. 3 | % Inputs: 4 | % ndx: The Ndx object to save. 5 | % outfilename: The name of the output hdf5 file. 6 | 7 | assert(nargin==2) 8 | assert(isa(ndx,'Ndx')) 9 | assert(isa(outfilename,'char')) 10 | assert(ndx.validate()) 11 | 12 | nummods = length(ndx.modelset); 13 | numsegs = length(ndx.segset); 14 | 15 | assert(size(ndx.trialmask,1)==nummods) 16 | assert(size(ndx.trialmask,2)==numsegs) 17 | 18 | trialmask = uint8(ndx.trialmask); 19 | 20 | hdf5write(outfilename,'/trial_mask',trialmask,'V71Dimensions',true); 21 | hdf5write(outfilename,'/ID/row_ids',ndx.modelset,'V71Dimensions',true,'WriteMode','append'); 22 | hdf5write(outfilename,'/ID/column_ids',ndx.segset,'V71Dimensions',true,'WriteMode','append'); 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Ndx/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(ndx,outfilename) 2 | % Saves the Ndx object in a mat file. 3 | % Inputs: 4 | % ndx: The Ndx object to save. 5 | % outfilename: The name of the output mat file. 6 | 7 | assert(nargin==2) 8 | assert(isa(ndx,'Ndx')) 9 | assert(isa(outfilename,'char')) 10 | assert(ndx.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | ndx = struct(ndx); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'ndx'); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Ndx/save_txt.m: -------------------------------------------------------------------------------- 1 | function save_txt(ndx,outfilename) 2 | % Saves the Ndx to a text file. 3 | % Inputs: 4 | % ndx: An object of type Ndx. 5 | % outfilename: The name for the output text file. 6 | 7 | assert(nargin==2) 8 | assert(isa(ndx,'Ndx')) 9 | assert(isa(outfilename,'char')) 10 | assert(ndx.validate()) 11 | 12 | outfile = fopen(outfilename,'w'); 13 | 14 | [x,y] = ind2sub(size(ndx.trialmask),find(ndx.trialmask)); 15 | numentries = length(x); 16 | for ii=1:numentries 17 | modelname = ndx.modelset{x(ii)}; 18 | segname = ndx.segset{y(ii)}; 19 | fprintf(outfile,'%s %s\n',modelname,segname); 20 | end 21 | 22 | fclose(outfile); 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Ndx/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(ndx) 2 | % Checks that an object of type Ndx obeys certain rules that 3 | % must always be true. 4 | % Inputs: 5 | % ndx: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(ndx,'Ndx')) 11 | 12 | ok = iscell(ndx.modelset); 13 | ok = ok && iscell(ndx.segset); 14 | 15 | nummods = length(ndx.modelset); 16 | numsegs = length(ndx.segset); 17 | 18 | ok = ok && (size(ndx.trialmask,1)==nummods); 19 | ok = ok && (size(ndx.trialmask,2)==numsegs); 20 | 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/add_legend_entry.m: -------------------------------------------------------------------------------- 1 | function add_legend_entry(plot_obj,lh,legend_string,append_name) 2 | % A private method that stores legend information for when 3 | % 'display_legend' is called. 4 | % Inputs: 5 | % lh: The handle for the curve. 6 | % legend_string: A string describing the curve. 7 | % append_name: A boolean indicating whether to prepend the system 8 | % name (set in 'set_system') to the 'legend_string'. 9 | 10 | assert(ischar(legend_string)) 11 | 12 | if ~strcmp(legend_string,'') 13 | plot_obj.handles_vec = [plot_obj.handles_vec lh]; 14 | if exist('append_name','var') && append_name 15 | plot_obj.legend_strings = {plot_obj.legend_strings{:},[plot_obj.sys_name ' ' legend_string]}; 16 | else 17 | plot_obj.legend_strings = {plot_obj.legend_strings{:},legend_string}; 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/display_legend.m: -------------------------------------------------------------------------------- 1 | function display_legend(plot_obj) 2 | % Displays the legend on the plot. Call this function only once 3 | % all curves have been plotted. 4 | 5 | if length(plot_obj.legend_strings) > 0 6 | figure(plot_obj.fh) 7 | legend(plot_obj.handles_vec,plot_obj.legend_strings) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_DR30_both.m: -------------------------------------------------------------------------------- 1 | function plot_DR30_both(plot_obj,plot_args_fa,plot_args_miss) 2 | % Plots two Doddington's Rule of 30 points: one for false alarms 3 | % and one for misses. See the documentation of plot_DR30_fa and 4 | % plot_DR30_miss for details. 5 | % Inputs: 6 | % plot_args_fa: A cell array of arguments to be passed to 'plot' 7 | % that control the appearance of the DR30_fa point. See Matlab's help 8 | % on 'plot' for information. 9 | % plot_args_miss: A cell array of arguments to be passed to 'plot' 10 | % that control the appearance of the DR30_miss point. See Matlab's help 11 | % on 'plot' for information. 12 | 13 | plot_obj.plot_DR30_fa(plot_args_fa,'pfa DR30'); 14 | plot_obj.plot_DR30_miss(plot_args_miss,'pmiss DR30'); 15 | 16 | end 17 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_dcf_curve_act.m: -------------------------------------------------------------------------------- 1 | function plot_dcf_curve_act(plot_obj,plot_args,legend_string) 2 | % Plots the actual DCF curve for the current system (see 3 | % set_system). 4 | % Inputs: 5 | % plot_args: A cell array of arguments to be passed to 'plot' 6 | % that control the appearance of the curve. See Matlab's help 7 | % on 'plot' for information. 8 | % legend_string: Optional. A string to describe this curve in the 9 | % legend. This string will be prepended with the system name. 10 | 11 | if ~exist('legend_string','var') 12 | legend_string = ''; 13 | end 14 | 15 | plot_obj.plot_dcf_curve(plot_obj.actDCF,plot_args,legend_string); 16 | end 17 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_dcf_curve_min.m: -------------------------------------------------------------------------------- 1 | function plot_dcf_curve_min(plot_obj,plot_args,legend_string) 2 | % Plots the minimum DCF curve for the current system (see 3 | % set_system). 4 | % Inputs: 5 | % plot_args: A cell array of arguments to be passed to 'plot' 6 | % that control the appearance of the curve. See Matlab's help 7 | % on 'plot' for information. 8 | % legend_string: Optional. A string to describe this curve in the 9 | % legend. This string will be prepended with the system name. 10 | 11 | if ~exist('legend_string','var') 12 | legend_string = ''; 13 | end 14 | 15 | plot_obj.plot_dcf_curve(plot_obj.minDCF,plot_args,legend_string); 16 | end 17 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_fa_rate_act.m: -------------------------------------------------------------------------------- 1 | function plot_fa_rate_act(plot_obj,plot_args,legend_string) 2 | % Plots the contribution of the false alarms to the actual dcf curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to 'plot' that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | % This string will be prepended with the system name. 8 | 9 | if ~exist('legend_string','var') 10 | legend_string = ''; 11 | end 12 | 13 | plot_obj.plot_fa_rate(plot_obj.actPfa,plot_args,legend_string); 14 | end 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_fa_rate_min.m: -------------------------------------------------------------------------------- 1 | function plot_fa_rate_min(plot_obj,plot_args,legend_string) 2 | % Plots the contribution of the false alarms to the minimum dcf curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to 'plot' that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | % This string will be prepended with the system name. 8 | 9 | if ~exist('legend_string','var') 10 | legend_string = ''; 11 | end 12 | 13 | plot_obj.plot_fa_rate(plot_obj.minPfa,plot_args,legend_string); 14 | end 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_miss_rate_act.m: -------------------------------------------------------------------------------- 1 | function plot_miss_rate_act(plot_obj,plot_args,legend_string) 2 | % Plots the contribution of the misses to the actual dcf curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to 'plot' that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | % This string will be prepended with the system name. 8 | 9 | if ~exist('legend_string','var') 10 | legend_string = ''; 11 | end 12 | 13 | plot_obj.plot_miss_rate(plot_obj.actPmiss,plot_args,legend_string); 14 | end 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_miss_rate_min.m: -------------------------------------------------------------------------------- 1 | function plot_miss_rate_min(plot_obj,plot_args,legend_string) 2 | % Plots the contribution of the misses to the minimum dcf curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to 'plot' that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | % This string will be prepended with the system name. 8 | 9 | if ~exist('legend_string','var') 10 | legend_string = ''; 11 | end 12 | 13 | plot_obj.plot_miss_rate(plot_obj.minPmiss,plot_args,legend_string); 14 | end 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Norm_DCF_Plot/save_as_pdf.m: -------------------------------------------------------------------------------- 1 | function save_as_pdf(plot_obj,outfilename) 2 | % Saves the plot to a PDF file. 3 | % Inputs: 4 | % outfilename: The name of the PDF file in which the plot will be 5 | % saved. 6 | 7 | assert(ischar(outfilename)) 8 | saveas(plot_obj.fh,outfilename,'pdf'); 9 | end 10 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Quality/read_mat.m: -------------------------------------------------------------------------------- 1 | function qual = read_mat(infilename) 2 | % Creates a Quality object from the information in a mat file. 3 | % Inputs: 4 | % infilename: A mat file containing quality measures. 5 | % Outputs: 6 | % qual: A Quality object encoding the quality measures in the 7 | % input mat file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'qual'); 13 | qual = Quality(qual); 14 | 15 | assert(qual.validate()) 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Quality/save.m: -------------------------------------------------------------------------------- 1 | function save(qual,outfilename) 2 | % Saves a Quality object to a file. The file type is determined by 3 | % the extension. 4 | % Inputs: 5 | % qual: The Quality object to be saved. 6 | % outfilename: The name for the output file. 7 | 8 | assert(nargin==2) 9 | assert(isa(qual,'Quality')) 10 | assert(isa(outfilename,'char')) 11 | assert(qual.validate()) 12 | 13 | dotpos = strfind(outfilename,'.'); 14 | assert(~isempty(dotpos)) 15 | extension = outfilename(dotpos(end)+1:end); 16 | assert(~isempty(extension)) 17 | 18 | if strcmp(extension,'hdf5') || strcmp(extension,'h5') 19 | qual.save_hdf5(outfilename); 20 | elseif strcmp(extension,'mat') 21 | qual.save_mat(outfilename); 22 | else 23 | error('Unknown extension "%s"\n',extension) 24 | end 25 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Quality/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(qual,outfilename) 2 | % Saves a Quality object to a mat file. 3 | % Inputs: 4 | % qual: The Quality object to be saved. 5 | % outfilename: The name for the mat output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(qual,'Quality')) 9 | assert(isa(outfilename,'char')) 10 | assert(qual.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | qual = struct(qual); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'qual'); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/get_scores.m: -------------------------------------------------------------------------------- 1 | function scores = get_scores(scr,ndx) 2 | % Inputs: 3 | % scr: A Scores object. 4 | % ndx: A Ndx object. 5 | % Outputs: 6 | % scores: A vector of all valid scores. 7 | 8 | assert(nargin==2) 9 | assert(isa(scr,'Scores')) 10 | assert(scr.validate()) 11 | assert(ndx.validate()) 12 | 13 | if isa(ndx,'Ndx') 14 | trialmask = ndx.trialmask; 15 | elseif isa(ndx,'Key') 16 | trialmask = ndx.tar | ndx.non; 17 | end 18 | 19 | scr = scr.align_with_ndx(ndx); 20 | scores = scr.scoremat; 21 | ii = trialmask & scr.scoremask; 22 | scores = scores(ii(:))'; 23 | end 24 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/get_tar_non.m: -------------------------------------------------------------------------------- 1 | function [tar,non] = get_tar_non(scr,key) 2 | % Divides scores into target and non-target scores using 3 | % information in a key. 4 | % Inputs: 5 | % scr: A Scores object. 6 | % key: A Key object. 7 | % Outputs: 8 | % tar: A vector of target scores. 9 | % non: A vector of non-target scores. 10 | 11 | assert(nargin==2) 12 | assert(isa(scr,'Scores')) 13 | assert(isa(key,'Key')) 14 | assert(scr.validate()) 15 | assert(key.validate()) 16 | 17 | scr = scr.align_with_ndx(key); 18 | scores = scr.scoremat; 19 | tarndx = key.tar & scr.scoremask; 20 | nonndx = key.non & scr.scoremask; 21 | tar = scores(tarndx(:))'; 22 | non = scores(nonndx(:))'; 23 | end 24 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/read_mat.m: -------------------------------------------------------------------------------- 1 | function scr = read_mat(infilename) 2 | % Creates a Scores object from the information in a mat file. 3 | % Inputs: 4 | % infilename: A mat file containing scores. 5 | % Outputs: 6 | % scr: A Scores object encoding the scores in the input mat 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'scr'); 13 | scr = Scores(scr); 14 | 15 | assert(scr.validate()) 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/save.m: -------------------------------------------------------------------------------- 1 | function save(scr,outfilename) 2 | % Saves a Scores object to a file. The file type is determined by 3 | % the extension. 4 | % Inputs: 5 | % scr: The Scores object to be saved. 6 | % outfilename: The name for the output file. 7 | 8 | assert(nargin==2) 9 | assert(isa(scr,'Scores')) 10 | assert(isa(outfilename,'char')) 11 | assert(scr.validate()) 12 | 13 | dotpos = strfind(outfilename,'.'); 14 | assert(~isempty(dotpos)) 15 | extension = outfilename(dotpos(end)+1:end); 16 | assert(~isempty(extension)) 17 | 18 | if strcmp(extension,'hdf5') || strcmp(extension,'h5') 19 | scr.save_hdf5(outfilename); 20 | elseif strcmp(extension,'mat') 21 | scr.save_mat(outfilename); 22 | elseif strcmp(extension,'txt') 23 | scr.save_txt(outfilename); 24 | else 25 | error('Unknown extension "%s"\n',extension) 26 | end 27 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/save_hdf5.m: -------------------------------------------------------------------------------- 1 | function save_hdf5(scr,outfilename) 2 | % Saves a Scores object to an hdf5 file. 3 | % Inputs: 4 | % scr: A Scores object. 5 | % outfilename: The name for the hdf5 output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(scr,'Scores')) 9 | assert(isa(outfilename,'char')) 10 | assert(scr.validate()) 11 | 12 | scoremask = uint8(scr.scoremask); 13 | 14 | hdf5write(outfilename,'/scores',scr.scoremat,'V71Dimensions',true); 15 | hdf5write(outfilename,'/score_mask',scoremask,'V71Dimensions',true,'WriteMode','append'); 16 | hdf5write(outfilename,'/ID/row_ids',scr.modelset,'V71Dimensions',true,'WriteMode','append'); 17 | hdf5write(outfilename,'/ID/column_ids',scr.segset,'V71Dimensions',true,'WriteMode','append'); 18 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(scr,outfilename) 2 | % Saves a Scores object to a mat file. 3 | % Inputs: 4 | % scr: A Scores object. 5 | % outfilename: The name for the mat output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(scr,'Scores')) 9 | assert(isa(outfilename,'char')) 10 | assert(scr.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | scr = struct(scr); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'scr'); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/save_txt.m: -------------------------------------------------------------------------------- 1 | function save_txt(scr,outfilename) 2 | % Saves a Scores object to a text file. 3 | % Inputs: 4 | % scr: A Scores object. 5 | % outfilename: The name for the text output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(scr,'Scores')) 9 | assert(isa(outfilename,'char')) 10 | assert(scr.validate()) 11 | 12 | [x,y] = ind2sub(size(scr.scoremask),find(scr.scoremask)); 13 | numscores = length(x); 14 | 15 | outfile = fopen(outfilename,'w'); 16 | 17 | for ii=1:numscores 18 | modelname = scr.modelset{x(ii)}; 19 | segname = scr.segset{y(ii)}; 20 | score = scr.scoremat(x(ii),y(ii)); 21 | assert(isfinite(score)) 22 | fprintf(outfile,'%s %s %f\n',modelname,segname,score); 23 | end 24 | 25 | fclose(outfile); 26 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/transform.m: -------------------------------------------------------------------------------- 1 | function new_scr = transform(scr,func) 2 | % Transforms the scores by sending them through the given function. 3 | % Inputs: 4 | % scr: A Scores object. 5 | % func: A function handle of the function to apply to the scores. 6 | % Outputs: 7 | % new_scr: A Scores object containing the transformed scores. 8 | 9 | assert(nargin==2) 10 | assert(isa(scr,'Scores')) 11 | assert(isa(func,'function_handle')) 12 | assert(scr.validate()) 13 | 14 | new_scr = scr; 15 | hasscores = scr.scoremask(:)'; 16 | new_scr.scoremat(hasscores) = func(scr.scoremat(hasscores)); 17 | 18 | assert(new_scr.validate()) 19 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Scores/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(scr) 2 | % Checks that an object of type Scores obeys certain rules that 3 | % must always be true. 4 | % Inputs: 5 | % scr: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(scr,'Scores')) 11 | 12 | ok = iscell(scr.modelset); 13 | ok = ok && iscell(scr.segset); 14 | 15 | nummods = length(scr.modelset); 16 | numsegs = length(scr.segset); 17 | 18 | ok = ok && (size(scr.scoremask,1)==nummods); 19 | ok = ok && (size(scr.scoremask,2)==numsegs); 20 | 21 | ok = ok && (size(scr.scoremat,1)==nummods); 22 | ok = ok && (size(scr.scoremat,2)==numsegs); 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Seg_Quality/merge.m: -------------------------------------------------------------------------------- 1 | function qual = merge(qual1,qual2) 2 | % Merges two Seg_Quality objects. The 'ids' lists of the two input 3 | % objects must be disjoint. 4 | % Inputs: 5 | % qual1: A Seg_Quality object. 6 | % qual2: Another Seg_Quality object. 7 | % Outputs: 8 | % qual: A Seg_Quality object that contains the information from 9 | % the two input objects. 10 | 11 | assert(nargin==2) 12 | assert(isa(qual1,'Seg_Quality')) 13 | assert(isa(qual2,'Seg_Quality')) 14 | assert(qual1.validate()) 15 | assert(qual2.validate()) 16 | 17 | assert(isempty(intersect(qual1.ids,qual2.ids))) 18 | 19 | qual = Seg_Quality(); 20 | qual.ids = {qual1.ids{:}, qual2.ids{:}}; 21 | qual.values = [qual1.values,qual2.values]; 22 | 23 | assert(qual.validate()) 24 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Seg_Quality/read_hdf5.m: -------------------------------------------------------------------------------- 1 | function qual = read_hdf5(infilename) 2 | % Creates a Seg_Quality object from the contents of an hdf5 file. 3 | % Inputs: 4 | % infilename: The name of the hdf5 file containing the quality 5 | % measure data. 6 | % Outputs: 7 | % qual: A Seg_Quality object encoding the information in the input 8 | % hdf5 file. 9 | 10 | assert(nargin==1) 11 | assert(isa(infilename,'char')) 12 | 13 | qual = Seg_Quality(); 14 | 15 | qual.values = hdf5read(infilename,'/values','V71Dimensions',true); 16 | 17 | tmp = hdf5read(infilename,'/ids','V71Dimensions',true); 18 | numentries = length(tmp); 19 | qual.ids = cell(numentries,1); 20 | for ii=1:numentries 21 | qual.ids{ii} = tmp(ii).Data; 22 | end 23 | 24 | assert(qual.validate()) 25 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Seg_Quality/read_mat.m: -------------------------------------------------------------------------------- 1 | function qual = read_mat(infilename) 2 | % Creates a Seg_Quality object from the information in a mat file. 3 | % Inputs: 4 | % infilename: A mat file that contains a struct with the same 5 | % fields as the Seg_Quality class. 6 | % Outputs: 7 | % qual: A Seg_Quality object encoding the quality measures in the 8 | % input mat file. 9 | 10 | assert(nargin==1) 11 | assert(isa(infilename,'char')) 12 | 13 | load(infilename,'qual'); 14 | qual = Seg_Quality(qual); 15 | 16 | assert(qual.validate()) 17 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Seg_Quality/read_txt.m: -------------------------------------------------------------------------------- 1 | function qual = read_txt(infilename) 2 | % Creates a Seg_Quality object from the contents of a text file. 3 | % Inputs: 4 | % infilename: The name of the text file to read. 5 | % Outputs: 6 | % qual: A Seg_Quality object encoding the information in the input 7 | % text file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | qual = Seg_Quality(); 13 | 14 | fid = fopen(infilename); 15 | numvalues = fscanf(fid,'%d',1); 16 | fstring = ['%s',repmat('%f',1,numvalues)]; 17 | lines = textscan(fid,fstring); 18 | fclose(fid); 19 | 20 | qual.ids = lines{1}; 21 | numids = length(qual.ids); 22 | qual.values = zeros(numvalues,numids); 23 | 24 | for ii=1:numvalues 25 | qual.values(ii,:) = lines{ii+1}; 26 | end 27 | 28 | assert(qual.validate()) 29 | 30 | end 31 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Seg_Quality/save_hdf5.m: -------------------------------------------------------------------------------- 1 | function save_hdf5(qual,outfilename) 2 | % Saves a Seg_Quality object to an hdf5 file. 3 | % Inputs: 4 | % qual: The Seg_Quality object to be saved. 5 | % outfilename: The name for the hdf5 output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(qual,'Seg_Quality')) 9 | assert(isa(outfilename,'char')) 10 | assert(qual.validate()) 11 | 12 | ids = cellstr(qual.ids); 13 | 14 | hdf5write(outfilename,'/values',qual.values,'V71Dimensions',true); 15 | hdf5write(outfilename,'/ids',ids,'V71Dimensions',true,'WriteMode','append'); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Seg_Quality/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(qual,outfilename) 2 | % Saves a Seg_Quality object to a mat file. 3 | % Inputs: 4 | % qual: The Seg_Quality object to be saved. 5 | % outfilename: The name for the mat output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(qual,'Seg_Quality')) 9 | assert(isa(outfilename,'char')) 10 | assert(qual.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | qual = struct(qual); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'qual'); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Seg_Quality/save_txt.m: -------------------------------------------------------------------------------- 1 | function save_txt(qual,outfilename) 2 | % Saves a Seg_Quality object to a text file. 3 | % Inputs: 4 | % qual: The Seg_Quality object to be saved. 5 | % outfilename: The name for the output text file. 6 | 7 | assert(nargin==2) 8 | assert(isa(qual,'Seg_Quality')) 9 | assert(isa(outfilename,'char')) 10 | assert(qual.validate()) 11 | 12 | outfile = fopen(outfilename,'w'); 13 | 14 | numids = length(qual.ids); 15 | numvalues = size(qual.values,1); 16 | 17 | fprintf(outfile,'%d\n',numvalues); 18 | 19 | for ii=1:numids 20 | segname = qual.ids{ii}; 21 | fprintf(outfile,'%s',segname); 22 | for jj=1:numvalues 23 | fprintf(outfile,' %f',qual.values(jj,ii)); 24 | end 25 | fprintf(outfile,'\n'); 26 | end 27 | 28 | fclose(outfile); 29 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/classes/@Seg_Quality/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(qual) 2 | % Checks that an object of type Seg_Quality obeys certain rules 3 | % that must always be true. 4 | % Inputs: 5 | % qual: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(qual,'Seg_Quality')) 11 | 12 | ok = iscell(qual.ids); 13 | ok = ok && (size(qual.values,2)==length(qual.ids)); 14 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/demo/demo_make_data_for_fusion.m: -------------------------------------------------------------------------------- 1 | function out_data = demo_make_data_for_fusion(numtar,numnon) 2 | % Make scores for two systems so that they can be fused. 3 | 4 | out_data.tar1 = 2*randn(1,numtar)+5; 5 | out_data.non1 = randn(1,numnon); 6 | out_data.tar2 = randn(1,numtar)+3; 7 | out_data.non2 = randn(1,numnon); 8 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/docs/bosaristoolkit_user_manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/bosaris_toolkit/docs/bosaristoolkit_user_manual.pdf -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/fusion/apply_linear_fusion_function.m: -------------------------------------------------------------------------------- 1 | function fused_scr = apply_linear_fusion_function(key_or_ndx,scores_obj_array,flin) 2 | % Preforms linear fusion by applying a linear fusion function to a 3 | % set of scores. 4 | % Inputs: 5 | % key_or_ndx: A Key or Ndx object describing the scores. 6 | % scores_obj_array: An array of score objects (one object for 7 | % each system) to be fused. 8 | % flin: The linear fusion function. 9 | % Outputs: 10 | % fused_scr: An object of type Scores containing the fused 11 | % scores. 12 | 13 | stacked_scores = stackScores(key_or_ndx,scores_obj_array); 14 | fused_scores = flin(stacked_scores)'; 15 | fused_scr = assemble_scr(fused_scores,key_or_ndx); 16 | end 17 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/fusion/funcs/applyQtrans.m: -------------------------------------------------------------------------------- 1 | function out_qual = applyQtrans(in_qual,Qtrans) 2 | % Combines (or discards) quality measures according to information 3 | % supplied in Qtrans. 4 | % Inputs: 5 | % in_qual: An object of type Quality containing quality measures. 6 | % Qtrans: A matrix indicating how the quality measures should be 7 | % combined. Use an identity matrix of 8 | % size(numsystems,numsystems) if you want the quality measures 9 | % to be used as is. 10 | % Outputs: 11 | % out_qual: An object of type Quality containing the quality 12 | % measures in in_qual modified according to Qtrans. 13 | 14 | logprint(Logger.Info,'Qtrans = \n%s',sprintfmatrix(Qtrans)); 15 | out_qual = in_qual; 16 | out_qual.modelQ = Qtrans*in_qual.modelQ; 17 | out_qual.segQ = Qtrans*in_qual.segQ; 18 | end 19 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/fusion/funcs/assemble_scr.m: -------------------------------------------------------------------------------- 1 | function scr = assemble_scr(scores,ndx) 2 | % Takes a vector of scores and produces a Scores object. 3 | % Inputs: 4 | % scores: An array of scores. 5 | % ndx: An object of type Key or Ndx. Information describing the 6 | % scores is extracted from this object. 7 | % Outputs: 8 | % scr: An object of type Scores containing the scores in 9 | % 'scores'. 10 | 11 | if isa(ndx,'Ndx') 12 | trialmask = ndx.trialmask; 13 | else 14 | trialmask = ndx.tar | ndx.non; 15 | end 16 | scr = Scores(); 17 | scr.scoremat = zeros(size(trialmask)); 18 | scr.scoremat(trialmask(:)) = scores; 19 | scr.scoremask = trialmask; 20 | scr.modelset = ndx.modelset; 21 | scr.segset = ndx.segset; 22 | end 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/fusion/funcs/estimate_target_proportions.m: -------------------------------------------------------------------------------- 1 | function props = estimate_target_proportions(scores,prior) 2 | % Estimates the ratio of target trials (out of all trials). 3 | % The posterior probability of a target is calculated for each 4 | % trial. Taking the mean of these posterior probabilities gives 5 | % the expected number of targets. 6 | % Inputs: 7 | % scores: An m-by-n matrix of llr scores where m is the number of 8 | % systems and n is the number of trials. 9 | % prior: The target prior (for the database). 10 | % Outputs: 11 | % props: A vector of estimated target proportions; one for each 12 | % system. 13 | 14 | assert(nargin==2) 15 | props = mean(sigmoid(scores+logit(prior)),2); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/fusion/funcs/make_classf_from_key.m: -------------------------------------------------------------------------------- 1 | function classf = make_classf_from_key(key) 2 | % Create a classf vector (for use in fusion functions) from a key. 3 | % Inputs: 4 | % key: A Key object indicating target and non-target trials. 5 | % Outputs: 6 | % classf: A vector containing 1s to indicate target trials, -1s to 7 | % indicate non-target trials and 0s to indicate trials to be ignored. 8 | 9 | assert(nargin==1) 10 | assert(isa(key,'Key')) 11 | 12 | trials = key.tar(:)' | key.non(:)'; 13 | tar = key.tar(trials); 14 | tar = tar(:)'; 15 | non = key.non(trials); 16 | non = non(:)'; 17 | numtrials = sum(trials); 18 | classf = zeros(1,numtrials); 19 | classf(tar) = 1; 20 | classf(non) = -1; 21 | 22 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/fusion/funcs/make_initial_fusion_weights.m: -------------------------------------------------------------------------------- 1 | function w0 = make_initial_fusion_weights(params) 2 | % Produces initial weights for training the fusion. 3 | % Inputs: 4 | % params: parameters of the untrained linear fusion function. 5 | % Outputs: 6 | % w0: The initial fusion weights to be given to the trainer. 7 | 8 | assert(nargin==1) 9 | 10 | % create initial weights. All zero didn't work, hence this initialization. 11 | w0 = params.get_w0(); 12 | w0(:) = 1 ./ (length(w0)-1); 13 | w0(end) = 0; 14 | 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/fusion/funcs/stackQ.m: -------------------------------------------------------------------------------- 1 | function qual = stackQ(ndx,qual_obj_array) 2 | % This function loads quality measures from files and creates a 3 | % single Quality object containing them. If two input files are 4 | % given, the quality measures from the second file are appended to 5 | % those from the first file. 6 | % Inputs: 7 | % ndx: A Key or Ndx object indicating trials. 8 | % qual_obj_array: An array of Quality objects; one for each system. 9 | % Output: 10 | % qual: An object of type Quality containing the quality measures 11 | % from all the input objects. 12 | 13 | assert(nargin==2) 14 | assert(isa(ndx,'Ndx')||isa(ndx,'Key')) 15 | 16 | num_systems = length(qual_obj_array); 17 | qual = qual_obj_array(1).align_with_ndx(ndx); 18 | for ii=2:num_systems 19 | qual = spliceQ(qual,qual_obj_array(ii),ndx); 20 | end 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/stats/area_under_rocch.m: -------------------------------------------------------------------------------- 1 | function auc = area_under_rocch(pmiss,pfa) 2 | % Calculates the area under the ROCCH (ROC convex hull) given the 3 | % rocch co-ordinates. 4 | % Inputs: 5 | % pmiss, pfa: vectors (with the same number of elements) 6 | % containing the ROCCH co-ordinates. 7 | % Outputs: 8 | % auc: The area under the ROCCH. 9 | 10 | assert(isvector(pmiss)) 11 | assert(isvector(pfa)) 12 | assert(issorted(pmiss)) 13 | assert(issorted(pfa(end:1))) 14 | assert(length(pmiss)==length(pfa)) 15 | 16 | auc = 0; 17 | for ii = 2:length(pmiss) 18 | auc = auc + 0.5 * (pmiss(ii) - pmiss(ii-1)) * (pfa(ii-1) + pfa(ii)); 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/stats/eer.m: -------------------------------------------------------------------------------- 1 | function eer_val = eer(tar,non) 2 | % Calculates the equal error rate from a set of target and 3 | % non-target scores. 4 | % Inputs: 5 | % tar: vector of target scores 6 | % non: vector of non-target scores 7 | % Output: 8 | % eer: the equal error rate. 9 | 10 | assert(isvector(tar)) 11 | assert(isvector(non)) 12 | 13 | [Pmiss,Pfa] = rocch(tar,non); 14 | eer_val = rocch2eer(Pmiss,Pfa); 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/stats/effective_prior.m: -------------------------------------------------------------------------------- 1 | function p = effective_prior(p_targ,cmiss,cfa); 2 | % p = EFFECTIVE_PRIOR(p_targ,cmiss,cfa) 3 | % 4 | % This function adjusts a given prior probability of target p_targ, 5 | % to incorporate the effects of a cost of miss, cmiss, and a cost of false-alarm, cfa. 6 | % In particular note: 7 | % EFFECTIVE_PRIOR(EFFECTIVE_PRIOR(p,cmiss,cfa),1,1) = EFFECTIVE_PRIOR(p,cfa,cmiss) 8 | % 9 | % The effective prior for the NIST SRE detection cost fuction, 10 | % with p_targ = 0.01, cmiss = 10, cfa = 1 is therefore: 11 | % EFFECTIVE_PRIOR(0.01,10,1) = 0.0917 12 | % 13 | 14 | p = p_targ*cmiss / (p_targ*cmiss + (1 - p_targ)*cfa); 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/stats/fastEval.m: -------------------------------------------------------------------------------- 1 | function [actdcf,mindcf,prbep,eer] = fastEval(tar,non,prior) 2 | % Calculates actual dcf, min dcf and prbeb values. 3 | % Inputs: 4 | % tar: A vector of target scores. 5 | % non: A vector of non-target scores. 6 | % prior: The effective target prior (or a vector of priors). 7 | % Outputs: 8 | % actdcf: The actual dcf value (or a vector if the prior is a vector). 9 | % mindcf: The minimum dcf value (or a vector if the prior is a vector). 10 | % prbep: Precision/Recall Break Even Point (#fa = #miss on ROCCH 11 | % curve). 12 | % eer: Equal error rate. 13 | 14 | assert(isvector(tar)) 15 | assert(isvector(non)) 16 | assert(isvector(prior)) 17 | 18 | actdcf = fast_actDCF(tar,non,logit(prior),true); 19 | [mindcf,pmiss,pfa,prbep,eer] = fast_minDCF(tar,non,logit(prior),true); 20 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/stats/prbep.m: -------------------------------------------------------------------------------- 1 | function pb = prbep(tar,non) 2 | % Calculates the PRBEP value for a set of target and non-target scores. 3 | % Inputs: 4 | % tar: vector of target scores 5 | % non: vector of non-target scores 6 | % Output: 7 | % prbep: precision-recall break-even point: Where #FA == #miss 8 | 9 | assert(isvector(tar)) 10 | assert(isvector(non)) 11 | 12 | [Pmiss,Pfa] = rocch(tar,non); 13 | Nmiss = Pmiss * length(tar); 14 | Nfa = Pfa * length(non); 15 | pb = rocch2eer(Nmiss,Nfa); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/2diff_chain_rules.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/2diff_chain_rules.pdf -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/WARNING_bug_when_using_singles.readme: -------------------------------------------------------------------------------- 1 | N.B. There is a problem with singles! Matlab seems not to work when wrapping single data in function handles. 2 | There are two workarounds: 3 | 1. Don't use singles anywhere. 4 | 2. Disable the JIT compiler: > feature('accel','off'); 5 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/crstepHess.m: -------------------------------------------------------------------------------- 1 | function H = crstepHess(f,x0,k) 2 | 3 | if ~exist('k','var') 4 | k = 1; 5 | end 6 | 7 | 8 | e = sqrt(eps(max(x0))); 9 | 10 | m = length(x0); 11 | H = zeros(m); 12 | for i=1:m 13 | for j=1:m 14 | 15 | x1 = x0; x1(i) = x1(i)+ 1e-20i; x1(j) = x1(j) + e; 16 | x2 = x0; x2(i) = x2(i)+ 1e-20i; x2(j) = x2(j) - e; 17 | y = (0.5e20/e)*imag(f(x1)-f(x2)); 18 | H(i,j) = y(k); 19 | 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/cstepHess.m: -------------------------------------------------------------------------------- 1 | function x = cstepHess(obj,x0,dx) 2 | %Approximates H * dx, where H is Hessian of obj at x0. 3 | % obj must supply gradient, which is then differentiated with complex step 4 | % method. 5 | % 6 | % Note: 7 | % -- gradient implementation must not use any complex arithmetic, but 8 | % must be able to accept complex arguments. 9 | % -- gradient implementation should use .' transpose, not conjugate 10 | % transpose ' 11 | 12 | x = x0 + 1e-20i*dx; 13 | [y,deriv] = obj(x); 14 | g = deriv(); 15 | x = 1e20*imag(g); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/cstepJacobian.m: -------------------------------------------------------------------------------- 1 | function J = cstepJacobian(f,w) 2 | 3 | x0=w; 4 | y0 = f(x0); 5 | n = length(x0); 6 | m = length(y0); 7 | J = zeros(m,n); 8 | for i=1:n; 9 | x = x0; 10 | x(i) = x0(i) + 1e-20i; 11 | y = f(x); 12 | J(:,i) = 1e20*imag(y); 13 | end 14 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/r2stepHess.m: -------------------------------------------------------------------------------- 1 | function x = r2stepHess(obj,x0,dx) 2 | alpha = sqrt(eps); 3 | x = x0 + alpha*dx; 4 | [y,deriv] = obj(x); 5 | g1 = deriv(); 6 | x = x0 - alpha*dx; 7 | [y,deriv] = obj(x); 8 | g2 = deriv(); 9 | 10 | x = (g1-g2)/(2*alpha); 11 | 12 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/r4stepHess.m: -------------------------------------------------------------------------------- 1 | function H = r4stepHess(f,x0,k) 2 | 3 | if ~exist('k','var') 4 | k = 1; 5 | end 6 | 7 | e = sqrt(sqrt(eps(max(x0)))); 8 | %e = sqrt(sqrt(eps)); 9 | 10 | m = length(x0); 11 | H = zeros(m); 12 | for i=1:m 13 | for j=1:m 14 | x1 = x0; x1(i)= x1(i)+e; x1(j)= x1(j)+e; 15 | x2 = x0; x2(i)= x2(i)+e; x2(j)= x2(j)-e; 16 | x3 = x0; x3(i)= x3(i)-e; x3(j)= x3(j)+e; 17 | x4 = x0; x4(i)= x4(i)-e; x4(j)= x4(j)-e; 18 | y = (f(x1)-f(x2)-f(x3)+f(x4))/(4*e^2); 19 | H(i,j) = y(k); 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/rstep.m: -------------------------------------------------------------------------------- 1 | function J = rstep(f,args,argno,argrow,outno); 2 | 3 | if nargin<4 4 | argrow=1; 5 | end 6 | if nargin<5 7 | outno=1; 8 | end 9 | str = cell(1,outno); 10 | if strcmp(class(f),'function_handle') 11 | [str{:}] = f(args{:}); 12 | else 13 | [str{:}] = feval(f,args{:}); 14 | end 15 | 16 | y0 = str{end}; 17 | x0 = args{argno}; 18 | dx = sqrt(eps); 19 | n = size(x0,2); 20 | J = zeros(length(y0),n); 21 | for i=1:n; 22 | x = x0; 23 | x(argrow,i) = x0(argrow,i) + dx; 24 | args{argno} = x; 25 | if strcmp(class(f),'function_handle') 26 | [str{:}] = f(args{:}); 27 | else 28 | [str{:}] = feval(f,args{:}); 29 | end 30 | y1 = str{end}; 31 | J(:,i) = (y1-y0)/dx; 32 | end 33 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/rstepHess.m: -------------------------------------------------------------------------------- 1 | function x = rstepHess(obj,x0,dx,grad0) 2 | alpha = sqrt(eps); 3 | x = x0 + alpha*dx; 4 | [y,deriv] = obj(x); 5 | g = deriv(); 6 | x = (g-grad0)/alpha; 7 | 8 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/rstepJacobian.m: -------------------------------------------------------------------------------- 1 | function J = rstepJacobian(f,w) 2 | 3 | 4 | x0=w; 5 | y0 = f(x0); 6 | n = length(x0); 7 | m = length(y0); 8 | J = zeros(m,n); 9 | dx = sqrt(eps); 10 | for i=1:n; 11 | x = x0; 12 | x(i) = x0(i) + dx; 13 | y1 = f(x); 14 | 15 | x = x0; 16 | x(i) = x0(i) - dx; 17 | y0 = f(x); 18 | J(:,i) = (y1-y0)/(2*dx); 19 | end 20 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/function_library/linear/identity_trans.m: -------------------------------------------------------------------------------- 1 | function [y,deriv] = identity_trans(w) 2 | % This is an MV2DF . See MV2DF_API_DEFINITION.readme. 3 | % 4 | % w --> w 5 | % 6 | 7 | 8 | if nargin==0 9 | test_this(); 10 | return; 11 | end 12 | 13 | 14 | if isempty(w) 15 | map = @(w) w; 16 | y = linTrans(w,map,map); 17 | return; 18 | end 19 | 20 | if isa(w,'function_handle') 21 | f = identity_trans([]); 22 | y = compose_mv(f,w,[]); 23 | return; 24 | end 25 | 26 | f = identity_trans([]); 27 | if nargout==1 28 | y = f(w); 29 | else 30 | [y,deriv] = f(w); 31 | end 32 | 33 | function test_this() 34 | 35 | f = identity_trans([]); 36 | test_MV2DF(f,randn(5,1)); 37 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/function_library/vector/what_goes_in_here.readme: -------------------------------------------------------------------------------- 1 | This directory is for MV2DF implementations of vectorized scalar functions. 2 | If f: R -> R, then these MV2DF implementations represent functions of the 3 | form F: R^N -> R^N, where the function f is applied to each element, just 4 | as MATLAB does when you call e.g. exp with a vector argument. -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/applications/fusion2class/experiments/synth_scores_with_quality.m: -------------------------------------------------------------------------------- 1 | function [scores,aux1,aux2,classf] = synth_scores_with_quality(means,H,N) 2 | 3 | tar = 1:N/2; 4 | non = tar+N/2; 5 | classf = -ones(1,N); 6 | classf(tar) = 1; 7 | 8 | 9 | [adim,rdim] = size(H); 10 | r1 = randn(rdim,N); 11 | r2 = randn(rdim,N); 12 | aux1 = H*r1 + randn(adim,N); 13 | aux2 = H*r2 + randn(adim,N); 14 | 15 | d1 = sum(r1.^2,1); 16 | d2 = sum(r2.^2,1); 17 | 18 | 19 | dim = size(means,1); 20 | 21 | scores = bsxfun(@times,randn(dim,N),sqrt(d1.*d2)); 22 | scores(:,tar) = bsxfun(@plus,scores(:,tar),means(:,1)); 23 | scores(:,non) = bsxfun(@plus,scores(:,non),means(:,2)); 24 | 25 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/applications/fusion2class/mv2df_function_library/addtotranspose_fh.m: -------------------------------------------------------------------------------- 1 | function fh = addtotranspose_fh(m,w) 2 | % This is almost an MV2DF, but it does not return derivatives on numeric 3 | % input, w. 4 | 5 | 6 | if nargin==0 7 | test_this(); 8 | return; 9 | end 10 | 11 | 12 | 13 | function y = map_this(w) 14 | w = reshape(w,m,m); 15 | y = w+w.'; 16 | end 17 | 18 | map = @(y) map_this(y); 19 | transmap = @(y) map_this(y); 20 | 21 | 22 | fh = linTrans([],map,transmap); 23 | 24 | if exist('w','var') && ~isempty(w) 25 | fh = fh(w); 26 | end 27 | 28 | 29 | end 30 | 31 | function test_this() 32 | m=3; 33 | f = addtotranspose_fh(3); 34 | test_MV2DF(f,randn(m*m,1)); 35 | end 36 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/Optimization_Toolkit/applications/fusion2class/mv2df_function_library/subvec_fh.m: -------------------------------------------------------------------------------- 1 | function fh = subvec_fh(first,len,w) 2 | % This is almost an MV2DF, but it does not return derivatives on numeric 3 | % input, w. 4 | 5 | 6 | if nargin==0 7 | test_this(); 8 | return; 9 | end 10 | 11 | 12 | map = @(w) w(first:first+len-1); 13 | 14 | function w = transmap_this(y,sz) 15 | w=zeros(sz,1); 16 | w(first:first+len-1)=y; 17 | end 18 | transmap = @(y,sz) transmap_this(y,sz); 19 | 20 | 21 | fh = linTrans_adaptive([],map,transmap); 22 | 23 | if exist('w','var') && ~isempty(w) 24 | fh = fh(w); 25 | end 26 | 27 | 28 | end 29 | 30 | function test_this() 31 | first = 2; 32 | len = 3; 33 | f = subvec_fh(first,len); 34 | test_MV2DF(f,randn(5,1)); 35 | end 36 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/load_qual_files.m: -------------------------------------------------------------------------------- 1 | function qual_obj_array = load_qual_files(filenames) 2 | % This function loads quality measures from files into an array of 3 | % Quality objects. 4 | % Inputs: 5 | % filenames: A list of files containing quality measures. 6 | % Output: 7 | % qual_obj_array: An array of Quality objects containing the same 8 | % number of elements as filenames. 9 | 10 | assert(iscell(filenames)) 11 | 12 | num_systems = length(filenames); 13 | qual_obj_array = Quality.empty(num_systems,0); 14 | 15 | log_info('quality:\n'); 16 | 17 | for ii=1:num_systems 18 | qual_obj_array(ii) = Quality.read(filenames{ii}); 19 | log_info(' %s\n',filenames{ii}); 20 | end 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/load_score_files.m: -------------------------------------------------------------------------------- 1 | function score_obj_array = load_score_files(scorefilenamelist) 2 | % Loads the scores for all the systems in the list into an array of 3 | % Scores objects. 4 | % Inputs 5 | % scorefilenamelist: A cell array of file name strings, one for 6 | % each system. 7 | % Outputs: 8 | % score_obj_array: An array of score objects, with the same 9 | % number of elements as scorefilenamelist. 10 | 11 | assert(iscell(scorefilenamelist)) 12 | 13 | numsystems = length(scorefilenamelist); 14 | 15 | score_obj_array = Scores.empty(numsystems,0); 16 | log_info('subsystems:\n'); 17 | for ii=1:numsystems 18 | log_info('%i: %s\n',ii,scorefilenamelist{ii}); 19 | score_obj_array(ii) = Scores.read(scorefilenamelist{ii}); 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/log_error.m: -------------------------------------------------------------------------------- 1 | function log_error(str,varargin) 2 | % Sends its inputs to the logger if it exists; otherwise does 3 | % nothing. The logging level is set to Error. 4 | % Inputs: 5 | % str: A string (possibly containing format specifiers). 6 | % varargin: An optional parameter list of values for the format 7 | % specifiers in the string. 8 | % See documentation for fprintf for a description of the 9 | % parameters 'str' and 'varargin'. 10 | 11 | assert(isa(str,'char')) 12 | 13 | outstr = ['Error: ',str]; 14 | 15 | logprint(Logger.Error,outstr,varargin{:}); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/log_info.m: -------------------------------------------------------------------------------- 1 | function log_info(str,varargin) 2 | % Sends its inputs to the logger if it exists; otherwise does 3 | % nothing. The logging level is set to Info. 4 | % Inputs: 5 | % str: A string (possibly containing format specifiers). 6 | % varargin: An optional parameter list of values for the format 7 | % specifiers in the string. 8 | % See documentation for fprintf for a description of the 9 | % parameters 'str' and 'varargin'. 10 | 11 | assert(isa(str,'char')) 12 | 13 | outstr = ['Info: ',str]; 14 | 15 | logprint(Logger.Info,outstr,varargin{:}); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/log_warning.m: -------------------------------------------------------------------------------- 1 | function log_warning(str,varargin) 2 | % Sends its inputs to the logger if it exists; otherwise does 3 | % nothing. The logging level is set to Warning. 4 | % Inputs: 5 | % str: A string (possibly containing format specifiers). 6 | % varargin: An optional parameter list of values for the format 7 | % specifiers in the string. 8 | % See documentation for fprintf for a description of the 9 | % parameters 'str' and 'varargin'. 10 | 11 | assert(isa(str,'char')) 12 | 13 | outstr = ['Warning: ',str]; 14 | 15 | logprint(Logger.Warning,outstr,varargin{:}); 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/logprint.m: -------------------------------------------------------------------------------- 1 | function logprint(level,str,varargin) 2 | % Sends its inputs to the logger if it exists; otherwise does nothing. 3 | % Inputs: 4 | % level: The logging level. The higher this number, the more 5 | % files it will be written to. If it is zero, the string will 6 | % not be logged. 7 | % str: A string (possibly containing format specifiers). 8 | % varargin: An optional parameter list of values for the format 9 | % specifiers in the string. 10 | % See documentation for fprintf for a description of the 11 | % parameters 'str' and 'varargin'. 12 | 13 | global logger 14 | 15 | assert(isa(str,'char')) 16 | assert(level>=0) 17 | 18 | if exist('logger','var') && ~isempty(logger) 19 | logger.log(level,str,varargin{:}); 20 | else 21 | fprintf(2,str,varargin{:}); 22 | end 23 | 24 | 25 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/read_list.m: -------------------------------------------------------------------------------- 1 | function outlist = read_list(filename) 2 | % Reads a list from a file. 3 | % Inputs: 4 | % filename: A text file containing a single column of strings. 5 | % Outputs: 6 | % outlist: A cell array of strings --- one string for each line 7 | % in the file. 8 | 9 | assert(isa(filename,'char')) 10 | 11 | fid = fopen(filename,'r'); 12 | cc = textscan(fid,'%s'); 13 | fclose(fid); 14 | 15 | outlist = cc{1}; 16 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/read_map.m: -------------------------------------------------------------------------------- 1 | function outmap = read_map(filename) 2 | % Reads a map from a file. The file must contain two columns with 3 | % keys in the first column and values in the second column. 4 | % Inputs: 5 | % filename: The name of the text file containing the map. 6 | % Outputs: 7 | % outmap: A struct with a cell array of keys and a cell array of 8 | % values. The cell arrays will be the same length and will 9 | % contain strings. 10 | 11 | assert(isa(filename,'char')) 12 | 13 | fid = fopen(filename,'r'); 14 | cc = textscan(fid,'%s%s'); 15 | fclose(fid); 16 | 17 | outmap.keySet = cc{1}; 18 | outmap.values = cc{2}; 19 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/save_list.m: -------------------------------------------------------------------------------- 1 | function save_list(filename,mylist) 2 | % Saves a cell array of strings to a text file. 3 | % Inputs: 4 | % filename: A text file containing a single column of strings. 5 | % outlist: A cell array of strings. 6 | 7 | assert(isa(filename,'char')) 8 | assert(iscell(mylist)) 9 | 10 | fid = fopen(filename,'w'); 11 | 12 | for ii=1:length(mylist) 13 | fprintf(fid,'%s\n',mylist{ii}); 14 | end 15 | 16 | fclose(fid); 17 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/data/sprintfmatrix.m: -------------------------------------------------------------------------------- 1 | function S = sprintfmatrix(X,rowid) 2 | % Formats a matrix for printing by converting to a string and 3 | % adding row labels and newlines. 4 | % Inputs: 5 | % X: The input matrix (of numbers). 6 | % rowid: Row labels. Can be numeric, cell array or char array. 7 | % Outputs: 8 | % S: The matrix converted to a string with formatting added. 9 | 10 | [m,n] = size(X); 11 | nnn = sprintf(repmat('\n',1,m))'; 12 | 13 | if exist('rowid','var') 14 | if isnumeric(rowid) 15 | rowid = num2str(rowid(:)); 16 | elseif iscell(rowid) 17 | rowid = char(rowid); 18 | end 19 | S = sprintf('%s',[rowid,repmat(': ',m,1),num2str(X),nnn]'); 20 | else 21 | S = sprintf('%s',[num2str(X),nnn]'); 22 | end 23 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/manip/make_objective_function_from_name.m: -------------------------------------------------------------------------------- 1 | function objective_function = make_objective_function_from_name(objective_name) 2 | 3 | assert(nargin==1) 4 | assert(isa(objective_name,'char')) 5 | 6 | if strcmpi(objective_name,'cllr') 7 | objective_function = @(w,T,weights,logit_prior) cllr_obj(w,T,weights,logit_prior); 8 | elseif strcmpi(objective_name,'brier') 9 | objective_function = @(w,T,weights,logit_prior) brier_obj(w,T,weights,logit_prior); 10 | elseif strcmpi(objective_name,'boost') 11 | objective_function = @(w,T,weights,logit_prior) boost_obj(w,T,weights,logit_prior); 12 | else 13 | error('name must be "cllr" or "brier" or "boost"') 14 | end 15 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/maths/logit.m: -------------------------------------------------------------------------------- 1 | function lp = logit(p) 2 | % LOGIT: logit function. 3 | % This is a one-to-one mapping from probability to log-odds. 4 | % i.e. it maps the interval (0,1) to the real line. 5 | % The inverse function is given by SIGMOID. 6 | % 7 | % log_odds = logit(p) = log(p/(1-p)) 8 | 9 | assert(nargin==1) 10 | 11 | lp = zeros(size(p)); 12 | f0 = find(p==0); 13 | f1 = find(p==1); 14 | f = find((p>0)&(p<1)); 15 | lp(f) = log(p(f)./(1-p(f))); 16 | lp(f0) = -inf; 17 | lp(f1) = inf; 18 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/bosaris_toolkit/utility_funcs/maths/neglogsigmoid.m: -------------------------------------------------------------------------------- 1 | function neg_log_p = neglogsigmoid(log_odds) 2 | % neg_log_p = NEGLOGSIGMOID(log_odds) 3 | % This is mathematically equivalent to -log(sigmoid(log_odds)), 4 | % but numerically better, when log_odds is large negative 5 | 6 | assert(nargin==1) 7 | 8 | neg_log_p = -log_odds; 9 | e = exp(-log_odds); 10 | f=find(ek 14 | ii(i) = 0; 15 | ii(i+1) = ii(i+1) + 1; 16 | end 17 | if ii(m+1)>0 18 | done = true; 19 | end 20 | end 21 | end 22 | 23 | 24 | 25 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/create_TPLDA.m: -------------------------------------------------------------------------------- 1 | function PLDA = create_TPLDA(F,W,nu) 2 | 3 | [D,d] = size(F); 4 | assert(D>d,'D>d required'); 5 | assert(nu>0,'nu>0 required'); 6 | 7 | FW = F.'*W; 8 | B = FW*F; 9 | 10 | [V,L] = eig(B); % B = V*L*V' % inv(B) = V*inv(L)*V' 11 | lambda = diag(L); 12 | assert(all(lambda>0),'F''WF should be invertible'); 13 | VFW = V.'*FW; 14 | 15 | G = W - VFW.'*bsxfun(@ldivide,lambda,VFW); 16 | 17 | 18 | PLDA.extract = @extract; 19 | 20 | 21 | function GME = extract(X) 22 | beta = (nu+D-d)./(nu+sum(X.'*G*X,1)); 23 | GME = [FW*X;beta]; 24 | end 25 | 26 | 27 | function 28 | 29 | 30 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/create_flat_partition_prior.m: -------------------------------------------------------------------------------- 1 | function prior = create_flat_partition_prior(n) 2 | 3 | if n>100 4 | const = - approx_log_Bell(n); 5 | else 6 | const = - logBell(n); 7 | end 8 | 9 | 10 | prior.logprob = @(counts) const; 11 | 12 | 13 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/CRP/K1.table: -------------------------------------------------------------------------------- 1 | 1 0.03 2 | 2 0.034 3 | 3 0.033 4 | 4 0.046 5 | 5 0.054 6 | 6 0.051 7 | 7 0.046 8 | 8 0.06 9 | 9 0.054 10 | 10 0.065 11 | 11 0.071 12 | 12 0.074 13 | 13 0.094 14 | 14 0.084 15 | 15 0.075 16 | 16 0.051 17 | 17 0.043 18 | 18 0.024 19 | 19 0.007 20 | 20 0.004 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/CRP/K2.table: -------------------------------------------------------------------------------- 1 | 1 0 2 | 2 0 3 | 3 0 4 | 4 0.003 5 | 5 0.01 6 | 6 0.023 7 | 7 0.083 8 | 8 0.117 9 | 9 0.172 10 | 10 0.196 11 | 11 0.176 12 | 12 0.116 13 | 13 0.05 14 | 14 0.043 15 | 15 0.009 16 | 16 0.002 17 | 17 0 18 | 18 0 19 | 19 0 20 | 20 0 21 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/CRP/randgumbel.m: -------------------------------------------------------------------------------- 1 | function r = randgumbel(m,n) 2 | 3 | r = -log(-log(rand(m,n))); 4 | 5 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/NUTS-matlab-master/Example/SP500.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/NUTS-matlab-master/Example/SP500.mat -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/NUTS-matlab-master/Example/german.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/NUTS-matlab-master/Example/german.mat -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/create_uvg_Prior.m: -------------------------------------------------------------------------------- 1 | function prior = create_uvg_Prior(mu,v) 2 | 3 | prior.sample = @sample; 4 | prior.logPDF = @logPDF; 5 | prior.Hessian = @logPDF_Hessian; 6 | 7 | function x = sample(n) 8 | if nargin==0 9 | n = 1; 10 | end 11 | x = mu+sqrt(v)*randn(1,n); 12 | end 13 | 14 | % y is (unnormalized) logPDF 15 | % y1 is dy/dx 16 | % y2 is dy1/dx 17 | function [y,y1] = logPDF(x) 18 | delta = x-mu; 19 | y = -delta.^2/(2*v); 20 | if nargout>=2 21 | y1 = -delta/v; 22 | end 23 | end 24 | 25 | 26 | function h = logPDF_Hessian(x) 27 | h = -1/v; 28 | end 29 | 30 | 31 | 32 | 33 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/gamma_vs_lognormal.m: -------------------------------------------------------------------------------- 1 | function [gamma,lognormal, inverse_gamma] = gamma_vs_lognormal(mean,variance) 2 | 3 | 4 | %lognormal 5 | v = log1p(variance/mean^2); 6 | mu = log(mean) - v/2; 7 | 8 | lognormal = @(x) exp(-(log(x)-mu).^2/(2*v)) ./ (x*sqrt(v*2*pi)); 9 | 10 | %gamma 11 | beta = mean/variance; 12 | alpha = beta*mean; 13 | gamma = @(x) beta^alpha * x.^(alpha-1) .* exp(-beta*x - gammaln(alpha)); 14 | 15 | inverse_gamma = @(x) beta^alpha * x.^(-alpha-1) .* exp(-beta./x - gammaln(alpha)); 16 | 17 | 18 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/logDirichlet.m: -------------------------------------------------------------------------------- 1 | function logP = logDirichlet(p,alpha) 2 | p = p(:); 3 | if isscalar(alpha) 4 | alpha = alpha*ones(size(p)); 5 | else 6 | alpha = alpha(:); 7 | assert(length(alpha)==length(p)); 8 | end 9 | logP = sum(log(p).*(alpha-1),1) + gammaln(sum(alpha,1)) - sum(gammaln(alpha),1); 10 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/plots/500_100_1.4_full_vs_collapsed.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/plots/500_100_1.4_full_vs_collapsed.pdf -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/plots/500_100_10_full_vs_collapsed.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/plots/500_100_10_full_vs_collapsed.pdf -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/plots/500_100_3_full_vs_collapsed.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/plots/500_100_3_full_vs_collapsed.pdf -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/plots/Gibbs_vs_VB_example1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/plots/Gibbs_vs_VB_example1.jpg -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/plots/Gibbs_vs_VB_example2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/plots/Gibbs_vs_VB_example2.jpg -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/randDirichlet.m: -------------------------------------------------------------------------------- 1 | function D = randDirichlet(alpha,m,n) 2 | D = randg(alpha,m,n); 3 | D = bsxfun(@rdivide,D,sum(D,1)); 4 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/stochastic_clustering.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/stochastic_clustering.zip -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/t-sne/tSNE_matlab.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/dpmm/t-sne/tSNE_matlab.zip -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/dpmm/testEER.m: -------------------------------------------------------------------------------- 1 | function EER = testEER(W,F,nspk) 2 | 3 | [D,d] = size(F); 4 | Z = randn(d,nspk); 5 | Enroll = F*Z + chol(W)\randn(D,nspk); 6 | Tar = F*Z + chol(W)\randn(D,nspk); 7 | Non = F*randn(d,nspk) + chol(W)\randn(D,nspk); 8 | 9 | E = F'*W*F; %meta-embedding precision (before diagonalization) 10 | [V,Lambda] = eig(E); %E = V*Lambda*V'; 11 | P = V.'*(F.'*W); % projection to extract 1st-order meta-embedding stats 12 | Lambda = diag(Lambda); 13 | Aenroll = P*Enroll; 14 | Atar = P*Tar; 15 | Anon = P*Non; 16 | 17 | logMEE = @(A,n) ( sum(bsxfun(@rdivide,A.^2,1+n*Lambda),1) - sum(log1p(n*Lambda),1) ) /2; 18 | score = @(A1,A2) logMEE(A1+A2,2) - logMEE(A1,1) - logMEE(A2,1); 19 | tar = score(Aenroll,Atar); 20 | non = score(Aenroll,Anon); 21 | EER = eer(tar,non); 22 | 23 | end 24 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/language_recognition/TLDIvector/precomputeTT.m: -------------------------------------------------------------------------------- 1 | function TT = precomputeTT(T,d,k,m) 2 | 3 | TT = zeros(k*k,m); 4 | ii = 1:d; 5 | for i=1:m 6 | Ti = T(ii,:); 7 | TT(:,i) = reshape(Ti.'*Ti,k*k,1); 8 | ii = ii + d; 9 | end 10 | 11 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/language_recognition/TLDIvector/stats2ivectors.m: -------------------------------------------------------------------------------- 1 | function [ivectors,TT,A,B] = stats2ivectors(F,Z,T,TT) 2 | % F: dm-by-n first-order stats 3 | % Z: m-by-n zero order stats 4 | % T: dm-by-k factor loading matrix 5 | % W: k-by-k within class precision 6 | % Mu: k-by-L language means 7 | % LLH: L-by-n language log-likelihoods 8 | % 9 | % 10 | % ivectors: k-by-n, classical i-vector point-estimates 11 | 12 | 13 | if ~exist('TT','var') 14 | TT = []; 15 | end 16 | 17 | [A,B,k,n,TT] = getPosteriorNatParams(F,Z,T,TT); 18 | 19 | I = eye(k); 20 | ivectors= zeros(k,n); 21 | for t=1:n 22 | Bt = reshape(B(:,t),k,k); 23 | ivectors(:,t) = (I+Bt)\A(:,t); 24 | end 25 | 26 | 27 | 28 | 29 | end 30 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/language_recognition/T_backend/McClachlan_Krishnan_The_EM_algorithm_and_extensions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/Niko/matlab/fous-y-tout/language_recognition/T_backend/McClachlan_Krishnan_The_EM_algorithm_and_extensions.pdf -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/logBell.m: -------------------------------------------------------------------------------- 1 | function [b, B] = logBell(n) 2 | % b = logBell(n) 3 | % n integer 4 | % Compute the log Bell number. It is the number of all possible partitions 5 | % of the set {1:N}. 6 | % 7 | % Complexity is quadratic in n. See also approx_log_Bell 8 | % 9 | if n==0 || n==1 10 | b = 0; 11 | B = zeros(n,1); 12 | return 13 | end 14 | A1 = zeros(1,n); 15 | A2 = zeros(1,n); 16 | A1(1) = 0; 17 | B = zeros(n,1); 18 | for i=2:n 19 | A2(1) = A1(i-1); 20 | for j=2:n 21 | a2 = A2(j-1); 22 | a1 = A1(j-1); 23 | if a2 > a1 24 | A2(j) = a2 + log1p(exp(a1-a2)); 25 | else 26 | A2(j) = a1 + log1p(exp(a2-a1)); 27 | end 28 | %A2(j) = A2(j-1) + A1(j-1); 29 | end 30 | A1 = A2; 31 | B(i) = A2(i); 32 | end 33 | b = A2(n); 34 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/logsumexp.m: -------------------------------------------------------------------------------- 1 | function [y,back] = logsumexp(X) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | mx = max(X,[],1); 9 | y = bsxfun(@plus,log(sum(exp(bsxfun(@minus,X,mx)),1)),mx); 10 | 11 | 12 | back = @back_this; 13 | 14 | function dX = back_this(dy) 15 | dX = bsxfun(@times,dy,exp(bsxfun(@minus,X,y))); 16 | 17 | end 18 | 19 | 20 | end 21 | 22 | 23 | function test_this() 24 | 25 | m = 3; 26 | n = 5; 27 | X = randn(m,n); 28 | testBackprop(@(X)logsumexp(X),X); 29 | 30 | 31 | end 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/plain_GME_log_expectations.m: -------------------------------------------------------------------------------- 1 | function y = plain_GME_log_expectations(A,B) 2 | 3 | [dim,ns] = size(A); 4 | y = zeros(1,ns); 5 | for i=1:ns 6 | E = create_plain_GME(A(:,i),reshape(B(:,i),dim,dim),0); 7 | y(i) = E.log_expectation(); 8 | end 9 | 10 | 11 | end 12 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/plotL2dist.m: -------------------------------------------------------------------------------- 1 | function [D,a,b] = plotL2dist 2 | 3 | x = create_plain_GME(0,10); %prior for now 4 | 5 | a = -10:0.1:10; 6 | b = 0.1:10; 7 | 8 | D = zeros(length(b),length(a)); 9 | 10 | for i=1:length(b); 11 | for j=1:length(a); 12 | y = create_plain_GME(a(j),b(i)); 13 | y = y.L1normalize(); 14 | D(i,j) = sqrt(x.distance_square(y)); 15 | end 16 | end 17 | 18 | 19 | 20 | 21 | 22 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/sampleChol.m: -------------------------------------------------------------------------------- 1 | function Z = sampleChol(a,B,n,X) 2 | 3 | dim = length(a); 4 | 5 | if ~exist('X','var') || isempty(X) 6 | X = randn(dim,n); 7 | end 8 | 9 | 10 | 11 | 12 | R = chol(B); 13 | Z = R \ bsxfun(@plus,R.'\a,X); 14 | 15 | 16 | 17 | 18 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/sumlogsoftmax.m: -------------------------------------------------------------------------------- 1 | function [y,back] = sumlogsoftmax(X,num) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | [den,back1] = sumlogsumexp(X); 9 | y = sum(X(num)) - den; 10 | 11 | 12 | back = @back_this; 13 | 14 | function dX = back_this(dy) 15 | dX = back1(-dy); 16 | dX(num) = dX(num) + dy; 17 | end 18 | 19 | 20 | end 21 | 22 | 23 | function test_this() 24 | 25 | m = 3; 26 | n = 5; 27 | X = randn(m,n); 28 | labels = randi(m,1,n); 29 | num = sub2ind(size(X),labels,1:n); 30 | testBackprop(@(X)sumlogsoftmax(X,num),X); 31 | 32 | 33 | end 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/sumlogsumexp.m: -------------------------------------------------------------------------------- 1 | function [y,back] = sumlogsumexp(X) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | mx = max(real(X),[],1); 9 | yy = mx + log(sum(exp(bsxfun(@minus,X,mx)),1)); 10 | y = sum(yy,2); 11 | 12 | back = @back_this; 13 | 14 | function dX = back_this(dy) 15 | dX = dy*exp(bsxfun(@minus,X,yy)); 16 | 17 | end 18 | 19 | 20 | end 21 | 22 | 23 | function test_this() 24 | 25 | m = 3; 26 | n = 5; 27 | X = randn(m,n); 28 | testBackprop(@(X)sumlogsumexp(X),X); 29 | 30 | 31 | end 32 | 33 | -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/synthdata/sample_HTPLDA_database.m: -------------------------------------------------------------------------------- 1 | function [R,Z,precisions,labels] = sample_HTPLDA_database(nu,F,labels,n,W) 2 | 3 | if isstruct(labels) %labels is prior 4 | prior = labels; 5 | labels = prior.sample(n); 6 | else 7 | assert(nargin==3,'if labels are given, do not also give n'); 8 | n = length(labels); %no of recordings 9 | end 10 | 11 | 12 | 13 | 14 | 15 | [D,dim] = size(F); 16 | ns = max(labels); %no of speakers 17 | subsets = sparse(labels2blocks(labels)); 18 | Z = randn(dim,ns); %speaker variables 19 | 20 | 21 | if ~exist('W','var') || isempty(W) 22 | [X,precisions] = sample_HTnoise(nu,D,n); 23 | else 24 | [X,precisions] = sample_HTnoise(nu,D,n,W); 25 | end 26 | 27 | 28 | 29 | 30 | R = F*(Z*subsets.') + X; 31 | 32 | end -------------------------------------------------------------------------------- /code/Niko/matlab/fous-y-tout/tme.m: -------------------------------------------------------------------------------- 1 | function y = tme(z,mu,W,nu) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | Delta = bsxfun(@minus,z,mu); 9 | q = sum(Delta.*(W*Delta),1); 10 | dim = length(mu); 11 | 12 | y = -(nu+dim)/2 * log1p(q/nu); 13 | 14 | 15 | end 16 | 17 | function test_this() 18 | 19 | dim = 1; 20 | W = 1; 21 | z = -10:0.01:10; 22 | mu1 = -5; 23 | mu2 = 5; 24 | 25 | nu = 1; 26 | y1 = tme(z,mu2,W,nu); 27 | y2 = tme(z,mu1,W,nu) 28 | 29 | 30 | plot(z,y1,z,y2,z,y1+y2); 31 | 32 | 33 | 34 | end -------------------------------------------------------------------------------- /code/Niko/matlab/stochastic_clustering/logDirichlet.m: -------------------------------------------------------------------------------- 1 | function logP = logDirichlet(p,alpha) 2 | p = p(:); 3 | if isscalar(alpha) 4 | alpha = alpha*ones(size(p)); 5 | else 6 | alpha = alpha(:); 7 | assert(length(alpha)==length(p)); 8 | end 9 | logP = sum(log(p).*(alpha-1),1) + gammaln(sum(alpha,1)) - sum(gammaln(alpha),1); 10 | end -------------------------------------------------------------------------------- /code/Niko/matlab/stochastic_clustering/randDirichlet.m: -------------------------------------------------------------------------------- 1 | function D = randDirichlet(alpha,m,n) 2 | D = randg(alpha,m,n); 3 | D = bsxfun(@rdivide,D,sum(D,1)); 4 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/Bell.m: -------------------------------------------------------------------------------- 1 | function [b B] = Bell(n) 2 | % b = Bell(N) 3 | % N integer 4 | % Compute the Bell's number. It is the number of all possible partitions 5 | % of the set {1:N}. 6 | % [b B] = Bell(N) returns in column vector B all Bell's numbers from 1 to N 7 | % 8 | % Author: Bruno Luong 9 | % History 10 | % Original: 17-May-2009 11 | % Last update: 18-May-2009, cosmetic changes 12 | 13 | n=double(n); 14 | if n==0 15 | b = 1; 16 | B = zeros(0,1); 17 | return 18 | end 19 | A = zeros(n); 20 | A(1,1) = 1; 21 | for i=2:n 22 | A(i,1) = A(i-1,i-1); 23 | for j=2:n 24 | A(i,j) = A(i,j-1) + A(i-1,j-1); 25 | end 26 | end 27 | b = A(n,n); 28 | if nargout>=2 29 | B = diag(A); 30 | end 31 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/CRP/K1.table: -------------------------------------------------------------------------------- 1 | 1 0.03 2 | 2 0.034 3 | 3 0.033 4 | 4 0.046 5 | 5 0.054 6 | 6 0.051 7 | 7 0.046 8 | 8 0.06 9 | 9 0.054 10 | 10 0.065 11 | 11 0.071 12 | 12 0.074 13 | 13 0.094 14 | 14 0.084 15 | 15 0.075 16 | 16 0.051 17 | 17 0.043 18 | 18 0.024 19 | 19 0.007 20 | 20 0.004 21 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/CRP/K2.table: -------------------------------------------------------------------------------- 1 | 1 0 2 | 2 0 3 | 3 0 4 | 4 0.003 5 | 5 0.01 6 | 6 0.023 7 | 7 0.083 8 | 8 0.117 9 | 9 0.172 10 | 10 0.196 11 | 11 0.176 12 | 12 0.116 13 | 13 0.05 14 | 14 0.043 15 | 15 0.009 16 | 16 0.002 17 | 17 0 18 | 18 0 19 | 19 0 20 | 20 0 21 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/CRP/randgumbel.m: -------------------------------------------------------------------------------- 1 | function r = randgumbel(m,n) 2 | 3 | r = -log(-log(rand(m,n))); 4 | 5 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/Orlov2002_partitions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/snapshot_for_anya/matlab/Orlov2002_partitions.pdf -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/approx_log_Bell.m: -------------------------------------------------------------------------------- 1 | function [logB,err] = approx_log_Bell(n) 2 | 3 | logn = log(n); 4 | loglogn = log(logn); 5 | 6 | logB = n.*( logn -loglogn -1 + (1+loglogn)./logn + 0.5*(loglogn./logn).^2 ); 7 | err = n.*loglogn./logn.^2; 8 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/binary_mixture_llh.m: -------------------------------------------------------------------------------- 1 | function llh = binary_mixture_llh(llh1,llh2,logitp) 2 | logp = -log1p(exp(-logitp)); 3 | logp1 = -log1p(exp(logitp)); 4 | llh = logsumexp([logp + llh1; logp1 + llh2]); 5 | 6 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Det_Plot/display_legend.m: -------------------------------------------------------------------------------- 1 | function display_legend(plot_obj) 2 | % Displays the legend on the plot. Call this function after all 3 | % curves and points have been plotted. The only function that 4 | % should be called after this one is the one for saving the plot. 5 | % Legend entries for curves are stored with add_legend_entry. 6 | 7 | if length(plot_obj.legend_strings) > 0 8 | figure(plot_obj.fh) 9 | legend(plot_obj.handles_vec,plot_obj.legend_strings) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Det_Plot/plot_DR30_both.m: -------------------------------------------------------------------------------- 1 | function plot_DR30_both(plot_obj,plot_args_fa,plot_args_miss) 2 | % Plots two lines indicating Doddington's Rule of 30 points: one 3 | % for false alarms and one for misses. See the documentation of 4 | % plot_DR30_fa and plot_DR30_miss for details. 5 | % Inputs: 6 | % plot_args_fa: A cell array of arguments to be passed to 'plot' that control 7 | % the appearance of the DR30_fa point. See Matlab's help on 'plot' for information. 8 | % plot_args_miss: A cell array of arguments to be passed to 'plot' that control 9 | % the appearance of the DR30_miss point. See Matlab's help on 'plot' for information. 10 | 11 | plot_obj.plot_DR30_fa(plot_args_fa,'pfa DR30'); 12 | plot_obj.plot_DR30_miss(plot_args_miss,'pmiss DR30'); 13 | 14 | end 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Det_Plot/plot_det_from_roc.m: -------------------------------------------------------------------------------- 1 | function plot_det_from_roc(plot_obj,Pmiss,Pfa,plot_args,legend_string) 2 | % Plots a DET curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to plot that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | 8 | if ischar(plot_args) 9 | plot_args = {plot_args}; 10 | end 11 | 12 | figure(plot_obj.fh); 13 | 14 | 15 | x = probit(Pfa); 16 | y = probit(Pmiss); 17 | assert(iscell(plot_args)) 18 | lh = plot(x,y,plot_args{:}); 19 | 20 | if exist('legend_string','var') && ~isempty(legend_string) 21 | assert(ischar(legend_string)) 22 | plot_obj.add_legend_entry(lh,legend_string,true); 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Det_Plot/prepare_plot.m: -------------------------------------------------------------------------------- 1 | function prepare_plot(plot_obj) 2 | % Creates a new figure, switches hold on, embellishes and returns handle. 3 | 4 | plot_obj.fh = figure(); 5 | hold on 6 | 7 | axis('square'); 8 | 9 | set(gca, 'xlim', probit(plot_obj.pfa_limits)); 10 | set(gca, 'xtick', probit(plot_obj.xticks)); 11 | set(gca, 'xticklabel', plot_obj.xticklabels); 12 | set(gca, 'xgrid', 'on'); 13 | xlabel('False Alarm probability (in %)'); 14 | 15 | set(gca, 'ylim', probit(plot_obj.pmiss_limits)); 16 | set(gca, 'ytick', probit(plot_obj.yticks)); 17 | set(gca, 'yticklabel', plot_obj.yticklabels); 18 | set(gca, 'ygrid', 'on') 19 | ylabel('Miss probability (in %)') 20 | 21 | end 22 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Det_Plot/save_as_pdf.m: -------------------------------------------------------------------------------- 1 | function save_as_pdf(plot_obj,outfilename) 2 | % Save the DET plot in a PDF file 3 | % Inputs: 4 | % outfilename: The name of the PDF file to save the plot in. 5 | 6 | assert(ischar(outfilename)) 7 | 8 | saveas(plot_obj.fh,outfilename,'pdf'); 9 | end 10 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Id_Map/read_mat.m: -------------------------------------------------------------------------------- 1 | function idmap = read_mat(infilename) 2 | % Reads a struct from a mat file and constructs an Id_Map object. 3 | % Inputs: 4 | % infilename: The name for the mat file to read. 5 | % Outputs: 6 | % idmap: An Id_Map object created from the information in the mat 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'idmap'); 13 | idmap = Id_Map(idmap); 14 | 15 | assert(idmap.validate()) 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Id_Map/read_txt.m: -------------------------------------------------------------------------------- 1 | function idmap = read_txt(infilename) 2 | % Reads ids from a text file and constructs an Id_Map object. 3 | % Inputs: 4 | % infilename: The name for the text file to read. 5 | % Outputs: 6 | % idmap: An Id_Map object created from the information in the text 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | fid = fopen(infilename); 13 | lines = textscan(fid,'%s%s'); 14 | fclose(fid); 15 | 16 | idmap = Id_Map(); 17 | idmap.leftids = lines{1}; 18 | idmap.rightids = lines{2}; 19 | 20 | assert(idmap.validate()) 21 | 22 | end 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Id_Map/save_hdf5.m: -------------------------------------------------------------------------------- 1 | function save_hdf5(idmap,outfilename) 2 | % Saves the Id_Map object to an hdf5 file. 3 | % Inputs: 4 | % idmap: The Id_Map object to save. 5 | % outfilename: The name of the output hdf5 file. 6 | 7 | assert(nargin==2) 8 | assert(isa(idmap,'Id_Map')) 9 | assert(isa(outfilename,'char')) 10 | assert(idmap.validate(false)) 11 | 12 | hdf5write(outfilename,'/left_ids',idmap.leftids,'V71Dimensions',true); 13 | hdf5write(outfilename,'/right_ids',idmap.rightids,'V71Dimensions',true,'WriteMode','append'); 14 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Id_Map/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(idmap,outfilename) 2 | % Saves the Id_Map object in a mat file. 3 | % Inputs: 4 | % idmap: The Id_Map object to save. 5 | % outfilename: The name of the output mat file. 6 | 7 | assert(nargin==2) 8 | assert(isa(idmap,'Id_Map')) 9 | assert(isa(outfilename,'char')) 10 | assert(idmap.validate(false)) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | idmap = struct(idmap); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'idmap'); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Id_Map/save_txt.m: -------------------------------------------------------------------------------- 1 | function save_txt(idmap,outfilename) 2 | % Saves the Id_Map to a text file. 3 | % Inputs: 4 | % idmap: An object of type Id_Map. 5 | % outfilename: The name for the output text file. 6 | 7 | assert(nargin==2) 8 | assert(isa(idmap,'Id_Map')) 9 | assert(isa(outfilename,'char')) 10 | assert(idmap.validate(false)) 11 | 12 | outfile = fopen(outfilename,'w'); 13 | 14 | numentries = length(idmap.leftids); 15 | for ii=1:numentries 16 | leftid = idmap.leftids{ii}; 17 | rightid = idmap.rightids{ii}; 18 | fprintf(outfile,'%s %s\n',leftid,rightid); 19 | end 20 | 21 | fclose(outfile); 22 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Key/read_mat.m: -------------------------------------------------------------------------------- 1 | function key = read_mat(infilename) 2 | % Reads a struct from a mat file and constructs a Key object. 3 | % Inputs: 4 | % infilename: The name for the mat file to read. 5 | % Outputs: 6 | % key: A Key object created from the information in the mat 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'key'); 13 | key = Key(key); 14 | 15 | assert(key.validate()) 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Key/save.m: -------------------------------------------------------------------------------- 1 | function save(key,outfilename) 2 | % Saves a Key object to a file. The file type is determined by 3 | % the extension. 4 | % Inputs: 5 | % key: The Key object to be saved. 6 | % outfilename: The name for the output file. 7 | 8 | assert(nargin==2) 9 | assert(isa(key,'Key')) 10 | assert(isa(outfilename,'char')) 11 | assert(key.validate()) 12 | 13 | dotpos = strfind(outfilename,'.'); 14 | assert(~isempty(dotpos)) 15 | extension = outfilename(dotpos(end)+1:end); 16 | assert(~isempty(extension)) 17 | 18 | if strcmp(extension,'hdf5') || strcmp(extension,'h5') 19 | key.save_hdf5(outfilename); 20 | elseif strcmp(extension,'mat') 21 | key.save_mat(outfilename); 22 | elseif strcmp(extension,'txt') 23 | key.save_txt(outfilename); 24 | else 25 | error('Unknown extension "%s"\n',extension) 26 | end 27 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Key/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(key,outfilename) 2 | % Saves the Key to a mat file. 3 | % Inputs: 4 | % key: An object of type Key. 5 | % outfilename: The name for the output mat file. 6 | 7 | assert(nargin==2) 8 | assert(isa(key,'Key')) 9 | assert(isa(outfilename,'char')) 10 | assert(key.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | key = struct(key); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'key'); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Key/to_ndx.m: -------------------------------------------------------------------------------- 1 | function ndx = to_ndx(key) 2 | % Returns an Ndx based on the Key. 3 | % Inputs: 4 | % key: An object of type Key. 5 | % Outputs: 6 | % ndx: An object of type Ndx. 7 | 8 | assert(nargin==1) 9 | assert(isa(key,'Key')) 10 | assert(key.validate()) 11 | 12 | ndx = Ndx(); 13 | ndx.modelset = key.modelset; 14 | ndx.segset = key.segset; 15 | ndx.trialmask = key.tar | key.non; 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Key/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(key) 2 | % Checks that an object of type Key obeys certain rules that 3 | % must always be true. 4 | % Inputs: 5 | % key: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(key,'Key')) 11 | 12 | ok = iscell(key.modelset); 13 | ok = ok && iscell(key.segset); 14 | 15 | nummods = length(key.modelset); 16 | numsegs = length(key.segset); 17 | 18 | ok = ok && (size(key.tar,1)==nummods); 19 | ok = ok && (size(key.tar,2)==numsegs); 20 | 21 | ok = ok && (size(key.non,1)==nummods); 22 | ok = ok && (size(key.non,2)==numsegs); 23 | 24 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/add_stderr.m: -------------------------------------------------------------------------------- 1 | function add_stderr(logger,level) 2 | % After a call to this method, log messages with the appropriate 3 | % level setting will be written to standard error (as well as other 4 | % log files). 5 | % Inputs: 6 | % level: Indicates which log messages should go to standard error. 7 | % See the class definition file for a list of levels. Levels 8 | % can be combined by bit oring them. 9 | 10 | if ~isempty(find(logger.fidlist==2)) 11 | fprintf('Warning: stderr is already in the list and will not be added.\n'); 12 | else 13 | logger.fidlist = [logger.fidlist, 2]; 14 | if ~exist('level','var') 15 | level = Logger.All; 16 | else 17 | assert(level >= 0) 18 | end 19 | logger.fidlevels = [logger.fidlevels, level]; 20 | end 21 | 22 | assert(logger.validate()) 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/add_stdout.m: -------------------------------------------------------------------------------- 1 | function add_stdout(logger,level) 2 | % After a call to this method, log messages with the appropriate 3 | % level setting will be written to standard out (as well as other 4 | % log files). 5 | % Inputs: 6 | % level: Indicates which log messages should go to standard out. 7 | % See the class definition file for a list of levels. Levels 8 | % can be combined by bit oring them. 9 | 10 | if ~isempty(find(logger.fidlist==1)) 11 | fprintf('Warning: stdin is already in the list and will not be added.\n'); 12 | else 13 | logger.fidlist = [logger.fidlist, 1]; 14 | if ~exist('level','var') 15 | level = Logger.All; 16 | else 17 | assert(level >= 0) 18 | end 19 | logger.fidlevels = [logger.fidlevels, level]; 20 | end 21 | 22 | assert(logger.validate()) 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/clear.m: -------------------------------------------------------------------------------- 1 | function clear(logger) 2 | % Removes all logfiles from the list. Files that were added using 3 | % their name (i.e. not their fid) are closed. 4 | 5 | logger.fidlist = []; 6 | logger.fidlevels = []; 7 | for ii=1:length(logger.filenamefids) 8 | fclose(logger.filenamefids(ii)); 9 | end 10 | logger.filenamelist = {}; 11 | logger.filenamefids = []; 12 | logger.filenamelevels = []; 13 | 14 | assert(logger.validate()) 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/log.m: -------------------------------------------------------------------------------- 1 | function log(logger,level,message,varargin) 2 | % Writes a message to all log files (and possibly standard out and 3 | % standard error). 4 | % Inputs: 5 | % level: The logging level. See the constants defined in the 6 | % class header. Several constants can be combined by bit oring 7 | % them. 8 | 9 | assert(logger.validate()) 10 | 11 | for ii=1:length(logger.fidlist) 12 | if bitand(logger.fidlevels(ii),level) 13 | fprintf(logger.fidlist(ii),message,varargin{:}); 14 | end 15 | end 16 | for ii=1:length(logger.filenamefids) 17 | if bitand(logger.filenamelevels(ii),level) 18 | fprintf(logger.filenamefids(ii),message,varargin{:}); 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/rm_fid.m: -------------------------------------------------------------------------------- 1 | function rm_fid(logger,fid) 2 | % Stops the logger writing to the given file. The file is not 3 | % closed (that is the responsibility of the user code). 4 | % Inputs: 5 | % fid: A file id of an open log file. 6 | 7 | f = find(logger.fidlist==fid); 8 | if isempty(f) 9 | fprintf('Warning: fid: %d is not in the list and can not be removed.\n',fid); 10 | else 11 | logger.fidlist(f) = []; 12 | logger.fidlevels(f) = []; 13 | end 14 | 15 | assert(logger.validate()) 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/rm_filename.m: -------------------------------------------------------------------------------- 1 | function rm_filename(logger,fname) 2 | % Stops the logger writing to the named file and closes the file. 3 | % Inputs: 4 | % fname: The name of the (open) log file. 5 | 6 | f = find(ismember(logger.filenamelist,fname)==1); 7 | if isempty(f) 8 | fprintf('Warning: filename "%s" is not in the list and can not be removed.\n',fname); 9 | else 10 | fid = logger.filenamefids(f); 11 | fclose(fid); 12 | logger.filenamelist(f) = []; 13 | logger.filenamefids(f) = []; 14 | logger.filenamelevels(f) = []; 15 | end 16 | 17 | assert(logger.validate()) 18 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/rm_stderr.m: -------------------------------------------------------------------------------- 1 | function rm_stderr(logger) 2 | % Stops the logger writing to standard error. 3 | 4 | f = find(logger.fidlist==2); 5 | if isempty(f) 6 | fprintf('Warning: stderr is not in the list and can not be removed.\n'); 7 | else 8 | logger.fidlist(f) = []; 9 | logger.fidlevels(f) = []; 10 | end 11 | 12 | assert(logger.validate()) 13 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/rm_stdout.m: -------------------------------------------------------------------------------- 1 | function rm_stdout(logger) 2 | % Stops the logger writing to the standard output. 3 | 4 | f = find(logger.fidlist==1); 5 | if isempty(f) 6 | fprintf('Warning: stdin is not in the list and can not be removed.\n'); 7 | else 8 | logger.fidlist(f) = []; 9 | logger.fidlevels(f) = []; 10 | end 11 | 12 | assert(logger.validate()) 13 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Logger/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(logger) 2 | % Checks that an object of type Logger obeys certain rules that 3 | % must always be true. 4 | % Inputs: 5 | % logger: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(logger,'Logger')) 11 | 12 | ok = length(logger.fidlist)==length(logger.fidlevels); 13 | ok = ok && length(logger.filenamelist)==length(logger.filenamefids); 14 | ok = ok && length(logger.filenamelist)==length(logger.filenamelevels); 15 | ok = ok && all(logger.fidlist > 0); 16 | ok = ok && all(logger.filenamefids > 0); 17 | ok = ok && all(logger.fidlevels >= 0); 18 | ok = ok && all(logger.fidlevels < 256); 19 | ok = ok && all(logger.filenamelevels >= 0); 20 | ok = ok && all(logger.filenamelevels < 256); 21 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Ndx/read_mat.m: -------------------------------------------------------------------------------- 1 | function ndx = read_mat(infilename) 2 | % Reads a struct from a mat file and constructs an Ndx object. 3 | % Inputs: 4 | % infilename: The name for the mat file to read. 5 | % Outputs: 6 | % ndx: An Ndx object created from the information in the mat 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'ndx'); 13 | ndx = Ndx(ndx); 14 | 15 | assert(ndx.validate()) 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Ndx/save.m: -------------------------------------------------------------------------------- 1 | function save(ndx,outfilename) 2 | % Saves an Ndx object to a file. The file type is determined by 3 | % the extension. 4 | % Inputs: 5 | % ndx: The Ndx object to be saved. 6 | % outfilename: The name for the output file. 7 | 8 | assert(nargin==2) 9 | assert(isa(ndx,'Ndx')) 10 | assert(isa(outfilename,'char')) 11 | assert(ndx.validate()) 12 | 13 | dotpos = strfind(outfilename,'.'); 14 | assert(~isempty(dotpos)) 15 | extension = outfilename(dotpos(end)+1:end); 16 | assert(~isempty(extension)) 17 | 18 | if strcmp(extension,'hdf5') || strcmp(extension,'h5') 19 | ndx.save_hdf5(outfilename); 20 | elseif strcmp(extension,'mat') 21 | ndx.save_mat(outfilename); 22 | elseif strcmp(extension,'txt') 23 | ndx.save_txt(outfilename); 24 | else 25 | error('Unknown extension "%s"\n',extension) 26 | end 27 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Ndx/save_hdf5.m: -------------------------------------------------------------------------------- 1 | function save_hdf5(ndx,outfilename) 2 | % Saves the Ndx object in an hdf5 file. 3 | % Inputs: 4 | % ndx: The Ndx object to save. 5 | % outfilename: The name of the output hdf5 file. 6 | 7 | assert(nargin==2) 8 | assert(isa(ndx,'Ndx')) 9 | assert(isa(outfilename,'char')) 10 | assert(ndx.validate()) 11 | 12 | nummods = length(ndx.modelset); 13 | numsegs = length(ndx.segset); 14 | 15 | assert(size(ndx.trialmask,1)==nummods) 16 | assert(size(ndx.trialmask,2)==numsegs) 17 | 18 | trialmask = uint8(ndx.trialmask); 19 | 20 | hdf5write(outfilename,'/trial_mask',trialmask,'V71Dimensions',true); 21 | hdf5write(outfilename,'/ID/row_ids',ndx.modelset,'V71Dimensions',true,'WriteMode','append'); 22 | hdf5write(outfilename,'/ID/column_ids',ndx.segset,'V71Dimensions',true,'WriteMode','append'); 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Ndx/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(ndx,outfilename) 2 | % Saves the Ndx object in a mat file. 3 | % Inputs: 4 | % ndx: The Ndx object to save. 5 | % outfilename: The name of the output mat file. 6 | 7 | assert(nargin==2) 8 | assert(isa(ndx,'Ndx')) 9 | assert(isa(outfilename,'char')) 10 | assert(ndx.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | ndx = struct(ndx); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'ndx'); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Ndx/save_txt.m: -------------------------------------------------------------------------------- 1 | function save_txt(ndx,outfilename) 2 | % Saves the Ndx to a text file. 3 | % Inputs: 4 | % ndx: An object of type Ndx. 5 | % outfilename: The name for the output text file. 6 | 7 | assert(nargin==2) 8 | assert(isa(ndx,'Ndx')) 9 | assert(isa(outfilename,'char')) 10 | assert(ndx.validate()) 11 | 12 | outfile = fopen(outfilename,'w'); 13 | 14 | [x,y] = ind2sub(size(ndx.trialmask),find(ndx.trialmask)); 15 | numentries = length(x); 16 | for ii=1:numentries 17 | modelname = ndx.modelset{x(ii)}; 18 | segname = ndx.segset{y(ii)}; 19 | fprintf(outfile,'%s %s\n',modelname,segname); 20 | end 21 | 22 | fclose(outfile); 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Ndx/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(ndx) 2 | % Checks that an object of type Ndx obeys certain rules that 3 | % must always be true. 4 | % Inputs: 5 | % ndx: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(ndx,'Ndx')) 11 | 12 | ok = iscell(ndx.modelset); 13 | ok = ok && iscell(ndx.segset); 14 | 15 | nummods = length(ndx.modelset); 16 | numsegs = length(ndx.segset); 17 | 18 | ok = ok && (size(ndx.trialmask,1)==nummods); 19 | ok = ok && (size(ndx.trialmask,2)==numsegs); 20 | 21 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/add_legend_entry.m: -------------------------------------------------------------------------------- 1 | function add_legend_entry(plot_obj,lh,legend_string,append_name) 2 | % A private method that stores legend information for when 3 | % 'display_legend' is called. 4 | % Inputs: 5 | % lh: The handle for the curve. 6 | % legend_string: A string describing the curve. 7 | % append_name: A boolean indicating whether to prepend the system 8 | % name (set in 'set_system') to the 'legend_string'. 9 | 10 | assert(ischar(legend_string)) 11 | 12 | if ~strcmp(legend_string,'') 13 | plot_obj.handles_vec = [plot_obj.handles_vec lh]; 14 | if exist('append_name','var') && append_name 15 | plot_obj.legend_strings = {plot_obj.legend_strings{:},[plot_obj.sys_name ' ' legend_string]}; 16 | else 17 | plot_obj.legend_strings = {plot_obj.legend_strings{:},legend_string}; 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/display_legend.m: -------------------------------------------------------------------------------- 1 | function display_legend(plot_obj) 2 | % Displays the legend on the plot. Call this function only once 3 | % all curves have been plotted. 4 | 5 | if length(plot_obj.legend_strings) > 0 6 | figure(plot_obj.fh) 7 | legend(plot_obj.handles_vec,plot_obj.legend_strings) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_DR30_both.m: -------------------------------------------------------------------------------- 1 | function plot_DR30_both(plot_obj,plot_args_fa,plot_args_miss) 2 | % Plots two Doddington's Rule of 30 points: one for false alarms 3 | % and one for misses. See the documentation of plot_DR30_fa and 4 | % plot_DR30_miss for details. 5 | % Inputs: 6 | % plot_args_fa: A cell array of arguments to be passed to 'plot' 7 | % that control the appearance of the DR30_fa point. See Matlab's help 8 | % on 'plot' for information. 9 | % plot_args_miss: A cell array of arguments to be passed to 'plot' 10 | % that control the appearance of the DR30_miss point. See Matlab's help 11 | % on 'plot' for information. 12 | 13 | plot_obj.plot_DR30_fa(plot_args_fa,'pfa DR30'); 14 | plot_obj.plot_DR30_miss(plot_args_miss,'pmiss DR30'); 15 | 16 | end 17 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_dcf_curve_act.m: -------------------------------------------------------------------------------- 1 | function plot_dcf_curve_act(plot_obj,plot_args,legend_string) 2 | % Plots the actual DCF curve for the current system (see 3 | % set_system). 4 | % Inputs: 5 | % plot_args: A cell array of arguments to be passed to 'plot' 6 | % that control the appearance of the curve. See Matlab's help 7 | % on 'plot' for information. 8 | % legend_string: Optional. A string to describe this curve in the 9 | % legend. This string will be prepended with the system name. 10 | 11 | if ~exist('legend_string','var') 12 | legend_string = ''; 13 | end 14 | 15 | plot_obj.plot_dcf_curve(plot_obj.actDCF,plot_args,legend_string); 16 | end 17 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_dcf_curve_min.m: -------------------------------------------------------------------------------- 1 | function plot_dcf_curve_min(plot_obj,plot_args,legend_string) 2 | % Plots the minimum DCF curve for the current system (see 3 | % set_system). 4 | % Inputs: 5 | % plot_args: A cell array of arguments to be passed to 'plot' 6 | % that control the appearance of the curve. See Matlab's help 7 | % on 'plot' for information. 8 | % legend_string: Optional. A string to describe this curve in the 9 | % legend. This string will be prepended with the system name. 10 | 11 | if ~exist('legend_string','var') 12 | legend_string = ''; 13 | end 14 | 15 | plot_obj.plot_dcf_curve(plot_obj.minDCF,plot_args,legend_string); 16 | end 17 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_fa_rate_act.m: -------------------------------------------------------------------------------- 1 | function plot_fa_rate_act(plot_obj,plot_args,legend_string) 2 | % Plots the contribution of the false alarms to the actual dcf curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to 'plot' that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | % This string will be prepended with the system name. 8 | 9 | if ~exist('legend_string','var') 10 | legend_string = ''; 11 | end 12 | 13 | plot_obj.plot_fa_rate(plot_obj.actPfa,plot_args,legend_string); 14 | end 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_fa_rate_min.m: -------------------------------------------------------------------------------- 1 | function plot_fa_rate_min(plot_obj,plot_args,legend_string) 2 | % Plots the contribution of the false alarms to the minimum dcf curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to 'plot' that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | % This string will be prepended with the system name. 8 | 9 | if ~exist('legend_string','var') 10 | legend_string = ''; 11 | end 12 | 13 | plot_obj.plot_fa_rate(plot_obj.minPfa,plot_args,legend_string); 14 | end 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_miss_rate_act.m: -------------------------------------------------------------------------------- 1 | function plot_miss_rate_act(plot_obj,plot_args,legend_string) 2 | % Plots the contribution of the misses to the actual dcf curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to 'plot' that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | % This string will be prepended with the system name. 8 | 9 | if ~exist('legend_string','var') 10 | legend_string = ''; 11 | end 12 | 13 | plot_obj.plot_miss_rate(plot_obj.actPmiss,plot_args,legend_string); 14 | end 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/plot_miss_rate_min.m: -------------------------------------------------------------------------------- 1 | function plot_miss_rate_min(plot_obj,plot_args,legend_string) 2 | % Plots the contribution of the misses to the minimum dcf curve. 3 | % Inputs: 4 | % plot_args: A cell array of arguments to be passed to 'plot' that control 5 | % the appearance of the curve. See Matlab's help on 'plot' for information. 6 | % legend_string: Optional. A string to describe this curve in the legend. 7 | % This string will be prepended with the system name. 8 | 9 | if ~exist('legend_string','var') 10 | legend_string = ''; 11 | end 12 | 13 | plot_obj.plot_miss_rate(plot_obj.minPmiss,plot_args,legend_string); 14 | end 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Norm_DCF_Plot/save_as_pdf.m: -------------------------------------------------------------------------------- 1 | function save_as_pdf(plot_obj,outfilename) 2 | % Saves the plot to a PDF file. 3 | % Inputs: 4 | % outfilename: The name of the PDF file in which the plot will be 5 | % saved. 6 | 7 | assert(ischar(outfilename)) 8 | saveas(plot_obj.fh,outfilename,'pdf'); 9 | end 10 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Quality/read_mat.m: -------------------------------------------------------------------------------- 1 | function qual = read_mat(infilename) 2 | % Creates a Quality object from the information in a mat file. 3 | % Inputs: 4 | % infilename: A mat file containing quality measures. 5 | % Outputs: 6 | % qual: A Quality object encoding the quality measures in the 7 | % input mat file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'qual'); 13 | qual = Quality(qual); 14 | 15 | assert(qual.validate()) 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Quality/save.m: -------------------------------------------------------------------------------- 1 | function save(qual,outfilename) 2 | % Saves a Quality object to a file. The file type is determined by 3 | % the extension. 4 | % Inputs: 5 | % qual: The Quality object to be saved. 6 | % outfilename: The name for the output file. 7 | 8 | assert(nargin==2) 9 | assert(isa(qual,'Quality')) 10 | assert(isa(outfilename,'char')) 11 | assert(qual.validate()) 12 | 13 | dotpos = strfind(outfilename,'.'); 14 | assert(~isempty(dotpos)) 15 | extension = outfilename(dotpos(end)+1:end); 16 | assert(~isempty(extension)) 17 | 18 | if strcmp(extension,'hdf5') || strcmp(extension,'h5') 19 | qual.save_hdf5(outfilename); 20 | elseif strcmp(extension,'mat') 21 | qual.save_mat(outfilename); 22 | else 23 | error('Unknown extension "%s"\n',extension) 24 | end 25 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Quality/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(qual,outfilename) 2 | % Saves a Quality object to a mat file. 3 | % Inputs: 4 | % qual: The Quality object to be saved. 5 | % outfilename: The name for the mat output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(qual,'Quality')) 9 | assert(isa(outfilename,'char')) 10 | assert(qual.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | qual = struct(qual); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'qual'); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/get_scores.m: -------------------------------------------------------------------------------- 1 | function scores = get_scores(scr,ndx) 2 | % Inputs: 3 | % scr: A Scores object. 4 | % ndx: A Ndx object. 5 | % Outputs: 6 | % scores: A vector of all valid scores. 7 | 8 | assert(nargin==2) 9 | assert(isa(scr,'Scores')) 10 | assert(scr.validate()) 11 | assert(ndx.validate()) 12 | 13 | if isa(ndx,'Ndx') 14 | trialmask = ndx.trialmask; 15 | elseif isa(ndx,'Key') 16 | trialmask = ndx.tar | ndx.non; 17 | end 18 | 19 | scr = scr.align_with_ndx(ndx); 20 | scores = scr.scoremat; 21 | ii = trialmask & scr.scoremask; 22 | scores = scores(ii(:))'; 23 | end 24 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/get_tar_non.m: -------------------------------------------------------------------------------- 1 | function [tar,non] = get_tar_non(scr,key) 2 | % Divides scores into target and non-target scores using 3 | % information in a key. 4 | % Inputs: 5 | % scr: A Scores object. 6 | % key: A Key object. 7 | % Outputs: 8 | % tar: A vector of target scores. 9 | % non: A vector of non-target scores. 10 | 11 | assert(nargin==2) 12 | assert(isa(scr,'Scores')) 13 | assert(isa(key,'Key')) 14 | assert(scr.validate()) 15 | assert(key.validate()) 16 | 17 | scr = scr.align_with_ndx(key); 18 | scores = scr.scoremat; 19 | tarndx = key.tar & scr.scoremask; 20 | nonndx = key.non & scr.scoremask; 21 | tar = scores(tarndx(:))'; 22 | non = scores(nonndx(:))'; 23 | end 24 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/read_mat.m: -------------------------------------------------------------------------------- 1 | function scr = read_mat(infilename) 2 | % Creates a Scores object from the information in a mat file. 3 | % Inputs: 4 | % infilename: A mat file containing scores. 5 | % Outputs: 6 | % scr: A Scores object encoding the scores in the input mat 7 | % file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | load(infilename,'scr'); 13 | scr = Scores(scr); 14 | 15 | assert(scr.validate()) 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/save.m: -------------------------------------------------------------------------------- 1 | function save(scr,outfilename) 2 | % Saves a Scores object to a file. The file type is determined by 3 | % the extension. 4 | % Inputs: 5 | % scr: The Scores object to be saved. 6 | % outfilename: The name for the output file. 7 | 8 | assert(nargin==2) 9 | assert(isa(scr,'Scores')) 10 | assert(isa(outfilename,'char')) 11 | assert(scr.validate()) 12 | 13 | dotpos = strfind(outfilename,'.'); 14 | assert(~isempty(dotpos)) 15 | extension = outfilename(dotpos(end)+1:end); 16 | assert(~isempty(extension)) 17 | 18 | if strcmp(extension,'hdf5') || strcmp(extension,'h5') 19 | scr.save_hdf5(outfilename); 20 | elseif strcmp(extension,'mat') 21 | scr.save_mat(outfilename); 22 | elseif strcmp(extension,'txt') 23 | scr.save_txt(outfilename); 24 | else 25 | error('Unknown extension "%s"\n',extension) 26 | end 27 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/save_hdf5.m: -------------------------------------------------------------------------------- 1 | function save_hdf5(scr,outfilename) 2 | % Saves a Scores object to an hdf5 file. 3 | % Inputs: 4 | % scr: A Scores object. 5 | % outfilename: The name for the hdf5 output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(scr,'Scores')) 9 | assert(isa(outfilename,'char')) 10 | assert(scr.validate()) 11 | 12 | scoremask = uint8(scr.scoremask); 13 | 14 | hdf5write(outfilename,'/scores',scr.scoremat,'V71Dimensions',true); 15 | hdf5write(outfilename,'/score_mask',scoremask,'V71Dimensions',true,'WriteMode','append'); 16 | hdf5write(outfilename,'/ID/row_ids',scr.modelset,'V71Dimensions',true,'WriteMode','append'); 17 | hdf5write(outfilename,'/ID/column_ids',scr.segset,'V71Dimensions',true,'WriteMode','append'); 18 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(scr,outfilename) 2 | % Saves a Scores object to a mat file. 3 | % Inputs: 4 | % scr: A Scores object. 5 | % outfilename: The name for the mat output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(scr,'Scores')) 9 | assert(isa(outfilename,'char')) 10 | assert(scr.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | scr = struct(scr); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'scr'); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/save_txt.m: -------------------------------------------------------------------------------- 1 | function save_txt(scr,outfilename) 2 | % Saves a Scores object to a text file. 3 | % Inputs: 4 | % scr: A Scores object. 5 | % outfilename: The name for the text output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(scr,'Scores')) 9 | assert(isa(outfilename,'char')) 10 | assert(scr.validate()) 11 | 12 | [x,y] = ind2sub(size(scr.scoremask),find(scr.scoremask)); 13 | numscores = length(x); 14 | 15 | outfile = fopen(outfilename,'w'); 16 | 17 | for ii=1:numscores 18 | modelname = scr.modelset{x(ii)}; 19 | segname = scr.segset{y(ii)}; 20 | score = scr.scoremat(x(ii),y(ii)); 21 | assert(isfinite(score)) 22 | fprintf(outfile,'%s %s %f\n',modelname,segname,score); 23 | end 24 | 25 | fclose(outfile); 26 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/transform.m: -------------------------------------------------------------------------------- 1 | function new_scr = transform(scr,func) 2 | % Transforms the scores by sending them through the given function. 3 | % Inputs: 4 | % scr: A Scores object. 5 | % func: A function handle of the function to apply to the scores. 6 | % Outputs: 7 | % new_scr: A Scores object containing the transformed scores. 8 | 9 | assert(nargin==2) 10 | assert(isa(scr,'Scores')) 11 | assert(isa(func,'function_handle')) 12 | assert(scr.validate()) 13 | 14 | new_scr = scr; 15 | hasscores = scr.scoremask(:)'; 16 | new_scr.scoremat(hasscores) = func(scr.scoremat(hasscores)); 17 | 18 | assert(new_scr.validate()) 19 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Scores/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(scr) 2 | % Checks that an object of type Scores obeys certain rules that 3 | % must always be true. 4 | % Inputs: 5 | % scr: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(scr,'Scores')) 11 | 12 | ok = iscell(scr.modelset); 13 | ok = ok && iscell(scr.segset); 14 | 15 | nummods = length(scr.modelset); 16 | numsegs = length(scr.segset); 17 | 18 | ok = ok && (size(scr.scoremask,1)==nummods); 19 | ok = ok && (size(scr.scoremask,2)==numsegs); 20 | 21 | ok = ok && (size(scr.scoremat,1)==nummods); 22 | ok = ok && (size(scr.scoremat,2)==numsegs); 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Seg_Quality/merge.m: -------------------------------------------------------------------------------- 1 | function qual = merge(qual1,qual2) 2 | % Merges two Seg_Quality objects. The 'ids' lists of the two input 3 | % objects must be disjoint. 4 | % Inputs: 5 | % qual1: A Seg_Quality object. 6 | % qual2: Another Seg_Quality object. 7 | % Outputs: 8 | % qual: A Seg_Quality object that contains the information from 9 | % the two input objects. 10 | 11 | assert(nargin==2) 12 | assert(isa(qual1,'Seg_Quality')) 13 | assert(isa(qual2,'Seg_Quality')) 14 | assert(qual1.validate()) 15 | assert(qual2.validate()) 16 | 17 | assert(isempty(intersect(qual1.ids,qual2.ids))) 18 | 19 | qual = Seg_Quality(); 20 | qual.ids = {qual1.ids{:}, qual2.ids{:}}; 21 | qual.values = [qual1.values,qual2.values]; 22 | 23 | assert(qual.validate()) 24 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Seg_Quality/read_hdf5.m: -------------------------------------------------------------------------------- 1 | function qual = read_hdf5(infilename) 2 | % Creates a Seg_Quality object from the contents of an hdf5 file. 3 | % Inputs: 4 | % infilename: The name of the hdf5 file containing the quality 5 | % measure data. 6 | % Outputs: 7 | % qual: A Seg_Quality object encoding the information in the input 8 | % hdf5 file. 9 | 10 | assert(nargin==1) 11 | assert(isa(infilename,'char')) 12 | 13 | qual = Seg_Quality(); 14 | 15 | qual.values = hdf5read(infilename,'/values','V71Dimensions',true); 16 | 17 | tmp = hdf5read(infilename,'/ids','V71Dimensions',true); 18 | numentries = length(tmp); 19 | qual.ids = cell(numentries,1); 20 | for ii=1:numentries 21 | qual.ids{ii} = tmp(ii).Data; 22 | end 23 | 24 | assert(qual.validate()) 25 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Seg_Quality/read_mat.m: -------------------------------------------------------------------------------- 1 | function qual = read_mat(infilename) 2 | % Creates a Seg_Quality object from the information in a mat file. 3 | % Inputs: 4 | % infilename: A mat file that contains a struct with the same 5 | % fields as the Seg_Quality class. 6 | % Outputs: 7 | % qual: A Seg_Quality object encoding the quality measures in the 8 | % input mat file. 9 | 10 | assert(nargin==1) 11 | assert(isa(infilename,'char')) 12 | 13 | load(infilename,'qual'); 14 | qual = Seg_Quality(qual); 15 | 16 | assert(qual.validate()) 17 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Seg_Quality/read_txt.m: -------------------------------------------------------------------------------- 1 | function qual = read_txt(infilename) 2 | % Creates a Seg_Quality object from the contents of a text file. 3 | % Inputs: 4 | % infilename: The name of the text file to read. 5 | % Outputs: 6 | % qual: A Seg_Quality object encoding the information in the input 7 | % text file. 8 | 9 | assert(nargin==1) 10 | assert(isa(infilename,'char')) 11 | 12 | qual = Seg_Quality(); 13 | 14 | fid = fopen(infilename); 15 | numvalues = fscanf(fid,'%d',1); 16 | fstring = ['%s',repmat('%f',1,numvalues)]; 17 | lines = textscan(fid,fstring); 18 | fclose(fid); 19 | 20 | qual.ids = lines{1}; 21 | numids = length(qual.ids); 22 | qual.values = zeros(numvalues,numids); 23 | 24 | for ii=1:numvalues 25 | qual.values(ii,:) = lines{ii+1}; 26 | end 27 | 28 | assert(qual.validate()) 29 | 30 | end 31 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Seg_Quality/save_hdf5.m: -------------------------------------------------------------------------------- 1 | function save_hdf5(qual,outfilename) 2 | % Saves a Seg_Quality object to an hdf5 file. 3 | % Inputs: 4 | % qual: The Seg_Quality object to be saved. 5 | % outfilename: The name for the hdf5 output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(qual,'Seg_Quality')) 9 | assert(isa(outfilename,'char')) 10 | assert(qual.validate()) 11 | 12 | ids = cellstr(qual.ids); 13 | 14 | hdf5write(outfilename,'/values',qual.values,'V71Dimensions',true); 15 | hdf5write(outfilename,'/ids',ids,'V71Dimensions',true,'WriteMode','append'); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Seg_Quality/save_mat.m: -------------------------------------------------------------------------------- 1 | function save_mat(qual,outfilename) 2 | % Saves a Seg_Quality object to a mat file. 3 | % Inputs: 4 | % qual: The Seg_Quality object to be saved. 5 | % outfilename: The name for the mat output file. 6 | 7 | assert(nargin==2) 8 | assert(isa(qual,'Seg_Quality')) 9 | assert(isa(outfilename,'char')) 10 | assert(qual.validate()) 11 | 12 | warning('off','MATLAB:structOnObject') 13 | qual = struct(qual); 14 | warning('on','MATLAB:structOnObject') 15 | save(outfilename,'qual'); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Seg_Quality/save_txt.m: -------------------------------------------------------------------------------- 1 | function save_txt(qual,outfilename) 2 | % Saves a Seg_Quality object to a text file. 3 | % Inputs: 4 | % qual: The Seg_Quality object to be saved. 5 | % outfilename: The name for the output text file. 6 | 7 | assert(nargin==2) 8 | assert(isa(qual,'Seg_Quality')) 9 | assert(isa(outfilename,'char')) 10 | assert(qual.validate()) 11 | 12 | outfile = fopen(outfilename,'w'); 13 | 14 | numids = length(qual.ids); 15 | numvalues = size(qual.values,1); 16 | 17 | fprintf(outfile,'%d\n',numvalues); 18 | 19 | for ii=1:numids 20 | segname = qual.ids{ii}; 21 | fprintf(outfile,'%s',segname); 22 | for jj=1:numvalues 23 | fprintf(outfile,' %f',qual.values(jj,ii)); 24 | end 25 | fprintf(outfile,'\n'); 26 | end 27 | 28 | fclose(outfile); 29 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/classes/@Seg_Quality/validate.m: -------------------------------------------------------------------------------- 1 | function ok = validate(qual) 2 | % Checks that an object of type Seg_Quality obeys certain rules 3 | % that must always be true. 4 | % Inputs: 5 | % qual: the object to be checked. 6 | % Outputs: 7 | % ok: a boolean value indicating whether the object is valid. 8 | 9 | assert(nargin==1) 10 | assert(isa(qual,'Seg_Quality')) 11 | 12 | ok = iscell(qual.ids); 13 | ok = ok && (size(qual.values,2)==length(qual.ids)); 14 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/demo/demo_make_data_for_fusion.m: -------------------------------------------------------------------------------- 1 | function out_data = demo_make_data_for_fusion(numtar,numnon) 2 | % Make scores for two systems so that they can be fused. 3 | 4 | out_data.tar1 = 2*randn(1,numtar)+5; 5 | out_data.non1 = randn(1,numnon); 6 | out_data.tar2 = randn(1,numtar)+3; 7 | out_data.non2 = randn(1,numnon); 8 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/docs/bosaristoolkit_user_manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/snapshot_for_anya/matlab/bosaris_toolkit/docs/bosaristoolkit_user_manual.pdf -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/fusion/apply_linear_fusion_function.m: -------------------------------------------------------------------------------- 1 | function fused_scr = apply_linear_fusion_function(key_or_ndx,scores_obj_array,flin) 2 | % Preforms linear fusion by applying a linear fusion function to a 3 | % set of scores. 4 | % Inputs: 5 | % key_or_ndx: A Key or Ndx object describing the scores. 6 | % scores_obj_array: An array of score objects (one object for 7 | % each system) to be fused. 8 | % flin: The linear fusion function. 9 | % Outputs: 10 | % fused_scr: An object of type Scores containing the fused 11 | % scores. 12 | 13 | stacked_scores = stackScores(key_or_ndx,scores_obj_array); 14 | fused_scores = flin(stacked_scores)'; 15 | fused_scr = assemble_scr(fused_scores,key_or_ndx); 16 | end 17 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/fusion/funcs/applyQtrans.m: -------------------------------------------------------------------------------- 1 | function out_qual = applyQtrans(in_qual,Qtrans) 2 | % Combines (or discards) quality measures according to information 3 | % supplied in Qtrans. 4 | % Inputs: 5 | % in_qual: An object of type Quality containing quality measures. 6 | % Qtrans: A matrix indicating how the quality measures should be 7 | % combined. Use an identity matrix of 8 | % size(numsystems,numsystems) if you want the quality measures 9 | % to be used as is. 10 | % Outputs: 11 | % out_qual: An object of type Quality containing the quality 12 | % measures in in_qual modified according to Qtrans. 13 | 14 | logprint(Logger.Info,'Qtrans = \n%s',sprintfmatrix(Qtrans)); 15 | out_qual = in_qual; 16 | out_qual.modelQ = Qtrans*in_qual.modelQ; 17 | out_qual.segQ = Qtrans*in_qual.segQ; 18 | end 19 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/fusion/funcs/assemble_scr.m: -------------------------------------------------------------------------------- 1 | function scr = assemble_scr(scores,ndx) 2 | % Takes a vector of scores and produces a Scores object. 3 | % Inputs: 4 | % scores: An array of scores. 5 | % ndx: An object of type Key or Ndx. Information describing the 6 | % scores is extracted from this object. 7 | % Outputs: 8 | % scr: An object of type Scores containing the scores in 9 | % 'scores'. 10 | 11 | if isa(ndx,'Ndx') 12 | trialmask = ndx.trialmask; 13 | else 14 | trialmask = ndx.tar | ndx.non; 15 | end 16 | scr = Scores(); 17 | scr.scoremat = zeros(size(trialmask)); 18 | scr.scoremat(trialmask(:)) = scores; 19 | scr.scoremask = trialmask; 20 | scr.modelset = ndx.modelset; 21 | scr.segset = ndx.segset; 22 | end 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/fusion/funcs/estimate_target_proportions.m: -------------------------------------------------------------------------------- 1 | function props = estimate_target_proportions(scores,prior) 2 | % Estimates the ratio of target trials (out of all trials). 3 | % The posterior probability of a target is calculated for each 4 | % trial. Taking the mean of these posterior probabilities gives 5 | % the expected number of targets. 6 | % Inputs: 7 | % scores: An m-by-n matrix of llr scores where m is the number of 8 | % systems and n is the number of trials. 9 | % prior: The target prior (for the database). 10 | % Outputs: 11 | % props: A vector of estimated target proportions; one for each 12 | % system. 13 | 14 | assert(nargin==2) 15 | props = mean(sigmoid(scores+logit(prior)),2); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/fusion/funcs/make_classf_from_key.m: -------------------------------------------------------------------------------- 1 | function classf = make_classf_from_key(key) 2 | % Create a classf vector (for use in fusion functions) from a key. 3 | % Inputs: 4 | % key: A Key object indicating target and non-target trials. 5 | % Outputs: 6 | % classf: A vector containing 1s to indicate target trials, -1s to 7 | % indicate non-target trials and 0s to indicate trials to be ignored. 8 | 9 | assert(nargin==1) 10 | assert(isa(key,'Key')) 11 | 12 | trials = key.tar(:)' | key.non(:)'; 13 | tar = key.tar(trials); 14 | tar = tar(:)'; 15 | non = key.non(trials); 16 | non = non(:)'; 17 | numtrials = sum(trials); 18 | classf = zeros(1,numtrials); 19 | classf(tar) = 1; 20 | classf(non) = -1; 21 | 22 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/fusion/funcs/make_initial_fusion_weights.m: -------------------------------------------------------------------------------- 1 | function w0 = make_initial_fusion_weights(params) 2 | % Produces initial weights for training the fusion. 3 | % Inputs: 4 | % params: parameters of the untrained linear fusion function. 5 | % Outputs: 6 | % w0: The initial fusion weights to be given to the trainer. 7 | 8 | assert(nargin==1) 9 | 10 | % create initial weights. All zero didn't work, hence this initialization. 11 | w0 = params.get_w0(); 12 | w0(:) = 1 ./ (length(w0)-1); 13 | w0(end) = 0; 14 | 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/fusion/funcs/stackQ.m: -------------------------------------------------------------------------------- 1 | function qual = stackQ(ndx,qual_obj_array) 2 | % This function loads quality measures from files and creates a 3 | % single Quality object containing them. If two input files are 4 | % given, the quality measures from the second file are appended to 5 | % those from the first file. 6 | % Inputs: 7 | % ndx: A Key or Ndx object indicating trials. 8 | % qual_obj_array: An array of Quality objects; one for each system. 9 | % Output: 10 | % qual: An object of type Quality containing the quality measures 11 | % from all the input objects. 12 | 13 | assert(nargin==2) 14 | assert(isa(ndx,'Ndx')||isa(ndx,'Key')) 15 | 16 | num_systems = length(qual_obj_array); 17 | qual = qual_obj_array(1).align_with_ndx(ndx); 18 | for ii=2:num_systems 19 | qual = spliceQ(qual,qual_obj_array(ii),ndx); 20 | end 21 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/stats/area_under_rocch.m: -------------------------------------------------------------------------------- 1 | function auc = area_under_rocch(pmiss,pfa) 2 | % Calculates the area under the ROCCH (ROC convex hull) given the 3 | % rocch co-ordinates. 4 | % Inputs: 5 | % pmiss, pfa: vectors (with the same number of elements) 6 | % containing the ROCCH co-ordinates. 7 | % Outputs: 8 | % auc: The area under the ROCCH. 9 | 10 | assert(isvector(pmiss)) 11 | assert(isvector(pfa)) 12 | assert(issorted(pmiss)) 13 | assert(issorted(pfa(end:1))) 14 | assert(length(pmiss)==length(pfa)) 15 | 16 | auc = 0; 17 | for ii = 2:length(pmiss) 18 | auc = auc + 0.5 * (pmiss(ii) - pmiss(ii-1)) * (pfa(ii-1) + pfa(ii)); 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/stats/eer.m: -------------------------------------------------------------------------------- 1 | function eer_val = eer(tar,non) 2 | % Calculates the equal error rate from a set of target and 3 | % non-target scores. 4 | % Inputs: 5 | % tar: vector of target scores 6 | % non: vector of non-target scores 7 | % Output: 8 | % eer: the equal error rate. 9 | 10 | assert(isvector(tar)) 11 | assert(isvector(non)) 12 | 13 | [Pmiss,Pfa] = rocch(tar,non); 14 | eer_val = rocch2eer(Pmiss,Pfa); 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/stats/effective_prior.m: -------------------------------------------------------------------------------- 1 | function p = effective_prior(p_targ,cmiss,cfa); 2 | % p = EFFECTIVE_PRIOR(p_targ,cmiss,cfa) 3 | % 4 | % This function adjusts a given prior probability of target p_targ, 5 | % to incorporate the effects of a cost of miss, cmiss, and a cost of false-alarm, cfa. 6 | % In particular note: 7 | % EFFECTIVE_PRIOR(EFFECTIVE_PRIOR(p,cmiss,cfa),1,1) = EFFECTIVE_PRIOR(p,cfa,cmiss) 8 | % 9 | % The effective prior for the NIST SRE detection cost fuction, 10 | % with p_targ = 0.01, cmiss = 10, cfa = 1 is therefore: 11 | % EFFECTIVE_PRIOR(0.01,10,1) = 0.0917 12 | % 13 | 14 | p = p_targ*cmiss / (p_targ*cmiss + (1 - p_targ)*cfa); 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/stats/fastEval.m: -------------------------------------------------------------------------------- 1 | function [actdcf,mindcf,prbep,eer] = fastEval(tar,non,prior) 2 | % Calculates actual dcf, min dcf and prbeb values. 3 | % Inputs: 4 | % tar: A vector of target scores. 5 | % non: A vector of non-target scores. 6 | % prior: The effective target prior (or a vector of priors). 7 | % Outputs: 8 | % actdcf: The actual dcf value (or a vector if the prior is a vector). 9 | % mindcf: The minimum dcf value (or a vector if the prior is a vector). 10 | % prbep: Precision/Recall Break Even Point (#fa = #miss on ROCCH 11 | % curve). 12 | % eer: Equal error rate. 13 | 14 | assert(isvector(tar)) 15 | assert(isvector(non)) 16 | assert(isvector(prior)) 17 | 18 | actdcf = fast_actDCF(tar,non,logit(prior),true); 19 | [mindcf,pmiss,pfa,prbep,eer] = fast_minDCF(tar,non,logit(prior),true); 20 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/stats/prbep.m: -------------------------------------------------------------------------------- 1 | function pb = prbep(tar,non) 2 | % Calculates the PRBEP value for a set of target and non-target scores. 3 | % Inputs: 4 | % tar: vector of target scores 5 | % non: vector of non-target scores 6 | % Output: 7 | % prbep: precision-recall break-even point: Where #FA == #miss 8 | 9 | assert(isvector(tar)) 10 | assert(isvector(non)) 11 | 12 | [Pmiss,Pfa] = rocch(tar,non); 13 | Nmiss = Pmiss * length(tar); 14 | Nfa = Pfa * length(non); 15 | pb = rocch2eer(Nmiss,Nfa); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/2diff_chain_rules.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/2diff_chain_rules.pdf -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/WARNING_bug_when_using_singles.readme: -------------------------------------------------------------------------------- 1 | N.B. There is a problem with singles! Matlab seems not to work when wrapping single data in function handles. 2 | There are two workarounds: 3 | 1. Don't use singles anywhere. 4 | 2. Disable the JIT compiler: > feature('accel','off'); 5 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/crstepHess.m: -------------------------------------------------------------------------------- 1 | function H = crstepHess(f,x0,k) 2 | 3 | if ~exist('k','var') 4 | k = 1; 5 | end 6 | 7 | 8 | e = sqrt(eps(max(x0))); 9 | 10 | m = length(x0); 11 | H = zeros(m); 12 | for i=1:m 13 | for j=1:m 14 | 15 | x1 = x0; x1(i) = x1(i)+ 1e-20i; x1(j) = x1(j) + e; 16 | x2 = x0; x2(i) = x2(i)+ 1e-20i; x2(j) = x2(j) - e; 17 | y = (0.5e20/e)*imag(f(x1)-f(x2)); 18 | H(i,j) = y(k); 19 | 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/cstepHess.m: -------------------------------------------------------------------------------- 1 | function x = cstepHess(obj,x0,dx) 2 | %Approximates H * dx, where H is Hessian of obj at x0. 3 | % obj must supply gradient, which is then differentiated with complex step 4 | % method. 5 | % 6 | % Note: 7 | % -- gradient implementation must not use any complex arithmetic, but 8 | % must be able to accept complex arguments. 9 | % -- gradient implementation should use .' transpose, not conjugate 10 | % transpose ' 11 | 12 | x = x0 + 1e-20i*dx; 13 | [y,deriv] = obj(x); 14 | g = deriv(); 15 | x = 1e20*imag(g); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/cstepJacobian.m: -------------------------------------------------------------------------------- 1 | function J = cstepJacobian(f,w) 2 | 3 | x0=w; 4 | y0 = f(x0); 5 | n = length(x0); 6 | m = length(y0); 7 | J = zeros(m,n); 8 | for i=1:n; 9 | x = x0; 10 | x(i) = x0(i) + 1e-20i; 11 | y = f(x); 12 | J(:,i) = 1e20*imag(y); 13 | end 14 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/r2stepHess.m: -------------------------------------------------------------------------------- 1 | function x = r2stepHess(obj,x0,dx) 2 | alpha = sqrt(eps); 3 | x = x0 + alpha*dx; 4 | [y,deriv] = obj(x); 5 | g1 = deriv(); 6 | x = x0 - alpha*dx; 7 | [y,deriv] = obj(x); 8 | g2 = deriv(); 9 | 10 | x = (g1-g2)/(2*alpha); 11 | 12 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/r4stepHess.m: -------------------------------------------------------------------------------- 1 | function H = r4stepHess(f,x0,k) 2 | 3 | if ~exist('k','var') 4 | k = 1; 5 | end 6 | 7 | e = sqrt(sqrt(eps(max(x0)))); 8 | %e = sqrt(sqrt(eps)); 9 | 10 | m = length(x0); 11 | H = zeros(m); 12 | for i=1:m 13 | for j=1:m 14 | x1 = x0; x1(i)= x1(i)+e; x1(j)= x1(j)+e; 15 | x2 = x0; x2(i)= x2(i)+e; x2(j)= x2(j)-e; 16 | x3 = x0; x3(i)= x3(i)-e; x3(j)= x3(j)+e; 17 | x4 = x0; x4(i)= x4(i)-e; x4(j)= x4(j)-e; 18 | y = (f(x1)-f(x2)-f(x3)+f(x4))/(4*e^2); 19 | H(i,j) = y(k); 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/rstep.m: -------------------------------------------------------------------------------- 1 | function J = rstep(f,args,argno,argrow,outno); 2 | 3 | if nargin<4 4 | argrow=1; 5 | end 6 | if nargin<5 7 | outno=1; 8 | end 9 | str = cell(1,outno); 10 | if strcmp(class(f),'function_handle') 11 | [str{:}] = f(args{:}); 12 | else 13 | [str{:}] = feval(f,args{:}); 14 | end 15 | 16 | y0 = str{end}; 17 | x0 = args{argno}; 18 | dx = sqrt(eps); 19 | n = size(x0,2); 20 | J = zeros(length(y0),n); 21 | for i=1:n; 22 | x = x0; 23 | x(argrow,i) = x0(argrow,i) + dx; 24 | args{argno} = x; 25 | if strcmp(class(f),'function_handle') 26 | [str{:}] = f(args{:}); 27 | else 28 | [str{:}] = feval(f,args{:}); 29 | end 30 | y1 = str{end}; 31 | J(:,i) = (y1-y0)/dx; 32 | end 33 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/rstepHess.m: -------------------------------------------------------------------------------- 1 | function x = rstepHess(obj,x0,dx,grad0) 2 | alpha = sqrt(eps); 3 | x = x0 + alpha*dx; 4 | [y,deriv] = obj(x); 5 | g = deriv(); 6 | x = (g-grad0)/alpha; 7 | 8 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/deriv_approx/rstepJacobian.m: -------------------------------------------------------------------------------- 1 | function J = rstepJacobian(f,w) 2 | 3 | 4 | x0=w; 5 | y0 = f(x0); 6 | n = length(x0); 7 | m = length(y0); 8 | J = zeros(m,n); 9 | dx = sqrt(eps); 10 | for i=1:n; 11 | x = x0; 12 | x(i) = x0(i) + dx; 13 | y1 = f(x); 14 | 15 | x = x0; 16 | x(i) = x0(i) - dx; 17 | y0 = f(x); 18 | J(:,i) = (y1-y0)/(2*dx); 19 | end 20 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/function_library/linear/identity_trans.m: -------------------------------------------------------------------------------- 1 | function [y,deriv] = identity_trans(w) 2 | % This is an MV2DF . See MV2DF_API_DEFINITION.readme. 3 | % 4 | % w --> w 5 | % 6 | 7 | 8 | if nargin==0 9 | test_this(); 10 | return; 11 | end 12 | 13 | 14 | if isempty(w) 15 | map = @(w) w; 16 | y = linTrans(w,map,map); 17 | return; 18 | end 19 | 20 | if isa(w,'function_handle') 21 | f = identity_trans([]); 22 | y = compose_mv(f,w,[]); 23 | return; 24 | end 25 | 26 | f = identity_trans([]); 27 | if nargout==1 28 | y = f(w); 29 | else 30 | [y,deriv] = f(w); 31 | end 32 | 33 | function test_this() 34 | 35 | f = identity_trans([]); 36 | test_MV2DF(f,randn(5,1)); 37 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/MV2DF/function_library/vector/what_goes_in_here.readme: -------------------------------------------------------------------------------- 1 | This directory is for MV2DF implementations of vectorized scalar functions. 2 | If f: R -> R, then these MV2DF implementations represent functions of the 3 | form F: R^N -> R^N, where the function f is applied to each element, just 4 | as MATLAB does when you call e.g. exp with a vector argument. -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/applications/fusion2class/experiments/synth_scores_with_quality.m: -------------------------------------------------------------------------------- 1 | function [scores,aux1,aux2,classf] = synth_scores_with_quality(means,H,N) 2 | 3 | tar = 1:N/2; 4 | non = tar+N/2; 5 | classf = -ones(1,N); 6 | classf(tar) = 1; 7 | 8 | 9 | [adim,rdim] = size(H); 10 | r1 = randn(rdim,N); 11 | r2 = randn(rdim,N); 12 | aux1 = H*r1 + randn(adim,N); 13 | aux2 = H*r2 + randn(adim,N); 14 | 15 | d1 = sum(r1.^2,1); 16 | d2 = sum(r2.^2,1); 17 | 18 | 19 | dim = size(means,1); 20 | 21 | scores = bsxfun(@times,randn(dim,N),sqrt(d1.*d2)); 22 | scores(:,tar) = bsxfun(@plus,scores(:,tar),means(:,1)); 23 | scores(:,non) = bsxfun(@plus,scores(:,non),means(:,2)); 24 | 25 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/applications/fusion2class/mv2df_function_library/addtotranspose_fh.m: -------------------------------------------------------------------------------- 1 | function fh = addtotranspose_fh(m,w) 2 | % This is almost an MV2DF, but it does not return derivatives on numeric 3 | % input, w. 4 | 5 | 6 | if nargin==0 7 | test_this(); 8 | return; 9 | end 10 | 11 | 12 | 13 | function y = map_this(w) 14 | w = reshape(w,m,m); 15 | y = w+w.'; 16 | end 17 | 18 | map = @(y) map_this(y); 19 | transmap = @(y) map_this(y); 20 | 21 | 22 | fh = linTrans([],map,transmap); 23 | 24 | if exist('w','var') && ~isempty(w) 25 | fh = fh(w); 26 | end 27 | 28 | 29 | end 30 | 31 | function test_this() 32 | m=3; 33 | f = addtotranspose_fh(3); 34 | test_MV2DF(f,randn(m*m,1)); 35 | end 36 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/Optimization_Toolkit/applications/fusion2class/mv2df_function_library/subvec_fh.m: -------------------------------------------------------------------------------- 1 | function fh = subvec_fh(first,len,w) 2 | % This is almost an MV2DF, but it does not return derivatives on numeric 3 | % input, w. 4 | 5 | 6 | if nargin==0 7 | test_this(); 8 | return; 9 | end 10 | 11 | 12 | map = @(w) w(first:first+len-1); 13 | 14 | function w = transmap_this(y,sz) 15 | w=zeros(sz,1); 16 | w(first:first+len-1)=y; 17 | end 18 | transmap = @(y,sz) transmap_this(y,sz); 19 | 20 | 21 | fh = linTrans_adaptive([],map,transmap); 22 | 23 | if exist('w','var') && ~isempty(w) 24 | fh = fh(w); 25 | end 26 | 27 | 28 | end 29 | 30 | function test_this() 31 | first = 2; 32 | len = 3; 33 | f = subvec_fh(first,len); 34 | test_MV2DF(f,randn(5,1)); 35 | end 36 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/load_qual_files.m: -------------------------------------------------------------------------------- 1 | function qual_obj_array = load_qual_files(filenames) 2 | % This function loads quality measures from files into an array of 3 | % Quality objects. 4 | % Inputs: 5 | % filenames: A list of files containing quality measures. 6 | % Output: 7 | % qual_obj_array: An array of Quality objects containing the same 8 | % number of elements as filenames. 9 | 10 | assert(iscell(filenames)) 11 | 12 | num_systems = length(filenames); 13 | qual_obj_array = Quality.empty(num_systems,0); 14 | 15 | log_info('quality:\n'); 16 | 17 | for ii=1:num_systems 18 | qual_obj_array(ii) = Quality.read(filenames{ii}); 19 | log_info(' %s\n',filenames{ii}); 20 | end 21 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/load_score_files.m: -------------------------------------------------------------------------------- 1 | function score_obj_array = load_score_files(scorefilenamelist) 2 | % Loads the scores for all the systems in the list into an array of 3 | % Scores objects. 4 | % Inputs 5 | % scorefilenamelist: A cell array of file name strings, one for 6 | % each system. 7 | % Outputs: 8 | % score_obj_array: An array of score objects, with the same 9 | % number of elements as scorefilenamelist. 10 | 11 | assert(iscell(scorefilenamelist)) 12 | 13 | numsystems = length(scorefilenamelist); 14 | 15 | score_obj_array = Scores.empty(numsystems,0); 16 | log_info('subsystems:\n'); 17 | for ii=1:numsystems 18 | log_info('%i: %s\n',ii,scorefilenamelist{ii}); 19 | score_obj_array(ii) = Scores.read(scorefilenamelist{ii}); 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/log_error.m: -------------------------------------------------------------------------------- 1 | function log_error(str,varargin) 2 | % Sends its inputs to the logger if it exists; otherwise does 3 | % nothing. The logging level is set to Error. 4 | % Inputs: 5 | % str: A string (possibly containing format specifiers). 6 | % varargin: An optional parameter list of values for the format 7 | % specifiers in the string. 8 | % See documentation for fprintf for a description of the 9 | % parameters 'str' and 'varargin'. 10 | 11 | assert(isa(str,'char')) 12 | 13 | outstr = ['Error: ',str]; 14 | 15 | logprint(Logger.Error,outstr,varargin{:}); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/log_info.m: -------------------------------------------------------------------------------- 1 | function log_info(str,varargin) 2 | % Sends its inputs to the logger if it exists; otherwise does 3 | % nothing. The logging level is set to Info. 4 | % Inputs: 5 | % str: A string (possibly containing format specifiers). 6 | % varargin: An optional parameter list of values for the format 7 | % specifiers in the string. 8 | % See documentation for fprintf for a description of the 9 | % parameters 'str' and 'varargin'. 10 | 11 | assert(isa(str,'char')) 12 | 13 | outstr = ['Info: ',str]; 14 | 15 | logprint(Logger.Info,outstr,varargin{:}); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/log_warning.m: -------------------------------------------------------------------------------- 1 | function log_warning(str,varargin) 2 | % Sends its inputs to the logger if it exists; otherwise does 3 | % nothing. The logging level is set to Warning. 4 | % Inputs: 5 | % str: A string (possibly containing format specifiers). 6 | % varargin: An optional parameter list of values for the format 7 | % specifiers in the string. 8 | % See documentation for fprintf for a description of the 9 | % parameters 'str' and 'varargin'. 10 | 11 | assert(isa(str,'char')) 12 | 13 | outstr = ['Warning: ',str]; 14 | 15 | logprint(Logger.Warning,outstr,varargin{:}); 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/logprint.m: -------------------------------------------------------------------------------- 1 | function logprint(level,str,varargin) 2 | % Sends its inputs to the logger if it exists; otherwise does nothing. 3 | % Inputs: 4 | % level: The logging level. The higher this number, the more 5 | % files it will be written to. If it is zero, the string will 6 | % not be logged. 7 | % str: A string (possibly containing format specifiers). 8 | % varargin: An optional parameter list of values for the format 9 | % specifiers in the string. 10 | % See documentation for fprintf for a description of the 11 | % parameters 'str' and 'varargin'. 12 | 13 | global logger 14 | 15 | assert(isa(str,'char')) 16 | assert(level>=0) 17 | 18 | if exist('logger','var') && ~isempty(logger) 19 | logger.log(level,str,varargin{:}); 20 | else 21 | fprintf(2,str,varargin{:}); 22 | end 23 | 24 | 25 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/read_list.m: -------------------------------------------------------------------------------- 1 | function outlist = read_list(filename) 2 | % Reads a list from a file. 3 | % Inputs: 4 | % filename: A text file containing a single column of strings. 5 | % Outputs: 6 | % outlist: A cell array of strings --- one string for each line 7 | % in the file. 8 | 9 | assert(isa(filename,'char')) 10 | 11 | fid = fopen(filename,'r'); 12 | cc = textscan(fid,'%s'); 13 | fclose(fid); 14 | 15 | outlist = cc{1}; 16 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/read_map.m: -------------------------------------------------------------------------------- 1 | function outmap = read_map(filename) 2 | % Reads a map from a file. The file must contain two columns with 3 | % keys in the first column and values in the second column. 4 | % Inputs: 5 | % filename: The name of the text file containing the map. 6 | % Outputs: 7 | % outmap: A struct with a cell array of keys and a cell array of 8 | % values. The cell arrays will be the same length and will 9 | % contain strings. 10 | 11 | assert(isa(filename,'char')) 12 | 13 | fid = fopen(filename,'r'); 14 | cc = textscan(fid,'%s%s'); 15 | fclose(fid); 16 | 17 | outmap.keySet = cc{1}; 18 | outmap.values = cc{2}; 19 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/save_list.m: -------------------------------------------------------------------------------- 1 | function save_list(filename,mylist) 2 | % Saves a cell array of strings to a text file. 3 | % Inputs: 4 | % filename: A text file containing a single column of strings. 5 | % outlist: A cell array of strings. 6 | 7 | assert(isa(filename,'char')) 8 | assert(iscell(mylist)) 9 | 10 | fid = fopen(filename,'w'); 11 | 12 | for ii=1:length(mylist) 13 | fprintf(fid,'%s\n',mylist{ii}); 14 | end 15 | 16 | fclose(fid); 17 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/data/sprintfmatrix.m: -------------------------------------------------------------------------------- 1 | function S = sprintfmatrix(X,rowid) 2 | % Formats a matrix for printing by converting to a string and 3 | % adding row labels and newlines. 4 | % Inputs: 5 | % X: The input matrix (of numbers). 6 | % rowid: Row labels. Can be numeric, cell array or char array. 7 | % Outputs: 8 | % S: The matrix converted to a string with formatting added. 9 | 10 | [m,n] = size(X); 11 | nnn = sprintf(repmat('\n',1,m))'; 12 | 13 | if exist('rowid','var') 14 | if isnumeric(rowid) 15 | rowid = num2str(rowid(:)); 16 | elseif iscell(rowid) 17 | rowid = char(rowid); 18 | end 19 | S = sprintf('%s',[rowid,repmat(': ',m,1),num2str(X),nnn]'); 20 | else 21 | S = sprintf('%s',[num2str(X),nnn]'); 22 | end 23 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/manip/make_objective_function_from_name.m: -------------------------------------------------------------------------------- 1 | function objective_function = make_objective_function_from_name(objective_name) 2 | 3 | assert(nargin==1) 4 | assert(isa(objective_name,'char')) 5 | 6 | if strcmpi(objective_name,'cllr') 7 | objective_function = @(w,T,weights,logit_prior) cllr_obj(w,T,weights,logit_prior); 8 | elseif strcmpi(objective_name,'brier') 9 | objective_function = @(w,T,weights,logit_prior) brier_obj(w,T,weights,logit_prior); 10 | elseif strcmpi(objective_name,'boost') 11 | objective_function = @(w,T,weights,logit_prior) boost_obj(w,T,weights,logit_prior); 12 | else 13 | error('name must be "cllr" or "brier" or "boost"') 14 | end 15 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/maths/logit.m: -------------------------------------------------------------------------------- 1 | function lp = logit(p) 2 | % LOGIT: logit function. 3 | % This is a one-to-one mapping from probability to log-odds. 4 | % i.e. it maps the interval (0,1) to the real line. 5 | % The inverse function is given by SIGMOID. 6 | % 7 | % log_odds = logit(p) = log(p/(1-p)) 8 | 9 | assert(nargin==1) 10 | 11 | lp = zeros(size(p)); 12 | f0 = find(p==0); 13 | f1 = find(p==1); 14 | f = find((p>0)&(p<1)); 15 | lp(f) = log(p(f)./(1-p(f))); 16 | lp(f0) = -inf; 17 | lp(f1) = inf; 18 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/bosaris_toolkit/utility_funcs/maths/neglogsigmoid.m: -------------------------------------------------------------------------------- 1 | function neg_log_p = neglogsigmoid(log_odds) 2 | % neg_log_p = NEGLOGSIGMOID(log_odds) 3 | % This is mathematically equivalent to -log(sigmoid(log_odds)), 4 | % but numerically better, when log_odds is large negative 5 | 6 | assert(nargin==1) 7 | 8 | neg_log_p = -log_odds; 9 | e = exp(-log_odds); 10 | f=find(ed,'D>d required'); 5 | assert(nu>0,'nu>0 required'); 6 | 7 | FW = F.'*W; 8 | B = FW*F; 9 | 10 | [V,L] = eig(B); % B = V*L*V' % inv(B) = V*inv(L)*V' 11 | lambda = diag(L); 12 | assert(all(lambda>0),'F''WF should be invertible'); 13 | VFW = V.'*FW; 14 | 15 | G = W - VFW.'*bsxfun(@ldivide,lambda,VFW); 16 | 17 | 18 | PLDA.extract = @extract; 19 | 20 | 21 | function GME = extract(X) 22 | beta = (nu+D-d)./(nu+sum(X.'*G*X,1)); 23 | GME = [FW*X;beta]; 24 | end 25 | 26 | 27 | function 28 | 29 | 30 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/create_flat_partition_prior.m: -------------------------------------------------------------------------------- 1 | function prior = create_flat_partition_prior(n) 2 | 3 | if n>100 4 | const = - approx_log_Bell(n); 5 | else 6 | const = - logBell(n); 7 | end 8 | 9 | 10 | prior.logprob = @(counts) const; 11 | 12 | 13 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/language_recognition/TLDIvector/precomputeTT.m: -------------------------------------------------------------------------------- 1 | function TT = precomputeTT(T,d,k,m) 2 | 3 | TT = zeros(k*k,m); 4 | ii = 1:d; 5 | for i=1:m 6 | Ti = T(ii,:); 7 | TT(:,i) = reshape(Ti.'*Ti,k*k,1); 8 | ii = ii + d; 9 | end 10 | 11 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/language_recognition/TLDIvector/stats2ivectors.m: -------------------------------------------------------------------------------- 1 | function [ivectors,TT,A,B] = stats2ivectors(F,Z,T,TT) 2 | % F: dm-by-n first-order stats 3 | % Z: m-by-n zero order stats 4 | % T: dm-by-k factor loading matrix 5 | % W: k-by-k within class precision 6 | % Mu: k-by-L language means 7 | % LLH: L-by-n language log-likelihoods 8 | % 9 | % 10 | % ivectors: k-by-n, classical i-vector point-estimates 11 | 12 | 13 | if ~exist('TT','var') 14 | TT = []; 15 | end 16 | 17 | [A,B,k,n,TT] = getPosteriorNatParams(F,Z,T,TT); 18 | 19 | I = eye(k); 20 | ivectors= zeros(k,n); 21 | for t=1:n 22 | Bt = reshape(B(:,t),k,k); 23 | ivectors(:,t) = (I+Bt)\A(:,t); 24 | end 25 | 26 | 27 | 28 | 29 | end 30 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/language_recognition/T_backend/McClachlan_Krishnan_The_EM_algorithm_and_extensions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/code/snapshot_for_anya/matlab/language_recognition/T_backend/McClachlan_Krishnan_The_EM_algorithm_and_extensions.pdf -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/logBell.m: -------------------------------------------------------------------------------- 1 | function [b, B] = logBell(n) 2 | % b = logBell(n) 3 | % n integer 4 | % Compute the log Bell number. It is the number of all possible partitions 5 | % of the set {1:N}. 6 | % 7 | % Complexity is quadratic in n. See also approx_log_Bell 8 | % 9 | if n==0 || n==1 10 | b = 0; 11 | B = zeros(n,1); 12 | return 13 | end 14 | A1 = zeros(1,n); 15 | A2 = zeros(1,n); 16 | A1(1) = 0; 17 | B = zeros(n,1); 18 | for i=2:n 19 | A2(1) = A1(i-1); 20 | for j=2:n 21 | a2 = A2(j-1); 22 | a1 = A1(j-1); 23 | if a2 > a1 24 | A2(j) = a2 + log1p(exp(a1-a2)); 25 | else 26 | A2(j) = a1 + log1p(exp(a2-a1)); 27 | end 28 | %A2(j) = A2(j-1) + A1(j-1); 29 | end 30 | A1 = A2; 31 | B(i) = A2(i); 32 | end 33 | b = A2(n); 34 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/logsumexp.m: -------------------------------------------------------------------------------- 1 | function [y,back] = logsumexp(X) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | mx = max(X,[],1); 9 | y = bsxfun(@plus,log(sum(exp(bsxfun(@minus,X,mx)),1)),mx); 10 | 11 | 12 | back = @back_this; 13 | 14 | function dX = back_this(dy) 15 | dX = bsxfun(@times,dy,exp(bsxfun(@minus,X,y))); 16 | 17 | end 18 | 19 | 20 | end 21 | 22 | 23 | function test_this() 24 | 25 | m = 3; 26 | n = 5; 27 | X = randn(m,n); 28 | testBackprop(@(X)logsumexp(X),X); 29 | 30 | 31 | end 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/plain_GME_log_expectations.m: -------------------------------------------------------------------------------- 1 | function y = plain_GME_log_expectations(A,B) 2 | 3 | [dim,ns] = size(A); 4 | y = zeros(1,ns); 5 | for i=1:ns 6 | E = create_plain_GME(A(:,i),reshape(B(:,i),dim,dim),0); 7 | y(i) = E.log_expectation(); 8 | end 9 | 10 | 11 | end 12 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/plotL2dist.m: -------------------------------------------------------------------------------- 1 | function [D,a,b] = plotL2dist 2 | 3 | x = create_plain_GME(0,10); %prior for now 4 | 5 | a = -10:0.1:10; 6 | b = 0.1:10; 7 | 8 | D = zeros(length(b),length(a)); 9 | 10 | for i=1:length(b); 11 | for j=1:length(a); 12 | y = create_plain_GME(a(j),b(i)); 13 | y = y.L1normalize(); 14 | D(i,j) = sqrt(x.distance_square(y)); 15 | end 16 | end 17 | 18 | 19 | 20 | 21 | 22 | end -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/sumlogsoftmax.m: -------------------------------------------------------------------------------- 1 | function [y,back] = sumlogsoftmax(X,num) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | [den,back1] = sumlogsumexp(X); 9 | y = sum(X(num)) - den; 10 | 11 | 12 | back = @back_this; 13 | 14 | function dX = back_this(dy) 15 | dX = back1(-dy); 16 | dX(num) = dX(num) + dy; 17 | end 18 | 19 | 20 | end 21 | 22 | 23 | function test_this() 24 | 25 | m = 3; 26 | n = 5; 27 | X = randn(m,n); 28 | labels = randi(m,1,n); 29 | num = sub2ind(size(X),labels,1:n); 30 | testBackprop(@(X)sumlogsoftmax(X,num),X); 31 | 32 | 33 | end 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/sumlogsumexp.m: -------------------------------------------------------------------------------- 1 | function [y,back] = sumlogsumexp(X) 2 | 3 | if nargin==0 4 | test_this(); 5 | return; 6 | end 7 | 8 | mx = max(real(X),[],1); 9 | yy = mx + log(sum(exp(bsxfun(@minus,X,mx)),1)); 10 | y = sum(yy,2); 11 | 12 | back = @back_this; 13 | 14 | function dX = back_this(dy) 15 | dX = dy*exp(bsxfun(@minus,X,yy)); 16 | 17 | end 18 | 19 | 20 | end 21 | 22 | 23 | function test_this() 24 | 25 | m = 3; 26 | n = 5; 27 | X = randn(m,n); 28 | testBackprop(@(X)sumlogsumexp(X),X); 29 | 30 | 31 | end 32 | 33 | -------------------------------------------------------------------------------- /code/snapshot_for_anya/matlab/synthdata/sample_HTPLDA_database.m: -------------------------------------------------------------------------------- 1 | function [R,Z,precisions,labels] = sample_HTPLDA_database(nu,F,labels,n) 2 | 3 | if isstruct(labels) %labels is prior 4 | prior = labels; 5 | labels = prior.sample(n); 6 | else 7 | assert(nargin==3,'if labels are given, do not also give n'); 8 | n = length(labels); %no of recordings 9 | end 10 | 11 | 12 | [D,dim] = size(F); 13 | ns = max(labels); %no of speakers 14 | subsets = sparse(labels2blocks(labels)); 15 | Z = randn(dim,ns); %speaker variables 16 | 17 | [X,precisions] = sample_HTnoise(nu,D,n); 18 | 19 | R = F*(Z*subsets.') + X; 20 | 21 | end -------------------------------------------------------------------------------- /plots/SGME_BXE_training_DET_plot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_BXE_training_DET_plot.pdf -------------------------------------------------------------------------------- /plots/SGME__BXE_training_DCF_plot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME__BXE_training_DCF_plot.pdf -------------------------------------------------------------------------------- /plots/SGME__BXE_training_DCF_plot_Train.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME__BXE_training_DCF_plot_Train.pdf -------------------------------------------------------------------------------- /plots/SGME_cal_PsL_vs_BXE_1000rec.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_cal_PsL_vs_BXE_1000rec.pdf -------------------------------------------------------------------------------- /plots/SGME_calibration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_calibration.pdf -------------------------------------------------------------------------------- /plots/SGME_calibration_MCL_vs_PsL.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_calibration_MCL_vs_PsL.pdf -------------------------------------------------------------------------------- /plots/SGME_calibration_PsL_1000recordings.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_calibration_PsL_1000recordings.pdf -------------------------------------------------------------------------------- /plots/SGME_nu_experiment_a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_nu_experiment_a.pdf -------------------------------------------------------------------------------- /plots/SGME_nu_experiment_b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_nu_experiment_b.pdf -------------------------------------------------------------------------------- /plots/SGME_training_DCF_plot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_training_DCF_plot.pdf -------------------------------------------------------------------------------- /plots/SGME_training_DET_plot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/SGME_training_DET_plot.pdf -------------------------------------------------------------------------------- /plots/Some_SGMEs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/plots/Some_SGMEs.pdf -------------------------------------------------------------------------------- /theory/MMEM_5Dec2017.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/MMEM_5Dec2017.pdf -------------------------------------------------------------------------------- /theory/Meta-embeddings Introduction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/Meta-embeddings Introduction.pdf -------------------------------------------------------------------------------- /theory/SGME_BXE_training_DET_plot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_BXE_training_DET_plot.pdf -------------------------------------------------------------------------------- /theory/SGME__BXE_training_DCF_plot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME__BXE_training_DCF_plot.pdf -------------------------------------------------------------------------------- /theory/SGME__BXE_training_DCF_plot_Train.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME__BXE_training_DCF_plot_Train.pdf -------------------------------------------------------------------------------- /theory/SGME_cal_PsL_vs_BXE_1000rec.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_cal_PsL_vs_BXE_1000rec.pdf -------------------------------------------------------------------------------- /theory/SGME_calibration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_calibration.pdf -------------------------------------------------------------------------------- /theory/SGME_calibration_MCL_vs_PsL.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_calibration_MCL_vs_PsL.pdf -------------------------------------------------------------------------------- /theory/SGME_calibration_PsL_1000recordings.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_calibration_PsL_1000recordings.pdf -------------------------------------------------------------------------------- /theory/SGME_nu_experiment_a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_nu_experiment_a.pdf -------------------------------------------------------------------------------- /theory/SGME_nu_experiment_b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_nu_experiment_b.pdf -------------------------------------------------------------------------------- /theory/SGME_training_DCF_plot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_training_DCF_plot.pdf -------------------------------------------------------------------------------- /theory/SGME_training_DET_plot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/SGME_training_DET_plot.pdf -------------------------------------------------------------------------------- /theory/Some_SGMEs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/Some_SGMEs.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure0.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure1.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure10.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure11.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure11.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure12.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure12.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure13.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure13.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure14.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure14.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure15.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure15.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure16.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure16.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure17.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure17.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure18.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure18.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure19.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure19.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure2.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure20.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure20.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure21.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure21.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure22.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure22.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure23.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure23.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure24.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure24.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure25.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure25.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure26.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure26.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure3.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure4.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure5.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure6.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure7.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure8.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding-figure9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding-figure9.pdf -------------------------------------------------------------------------------- /theory/algebra_embedding.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/algebra_embedding.pdf -------------------------------------------------------------------------------- /theory/composite_likelihood/cl4p.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/composite_likelihood/cl4p.pdf -------------------------------------------------------------------------------- /theory/lattice_of_partitions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/lattice_of_partitions.png -------------------------------------------------------------------------------- /theory/meta-embeddings_30Nov17_presentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsxfan/meta-embeddings/22f2aa995e016a415fb9244562a0946ea339bfa5/theory/meta-embeddings_30Nov17_presentation.pdf -------------------------------------------------------------------------------- /theory/readme.md: -------------------------------------------------------------------------------- 1 | # Meta-embedding theory 2 | 3 | This folder holds the LaTeX source and current [PDF](https://github.com/bsxfan/meta-embeddings/blob/master/theory/algebra_embedding.pdf) for the document describing meta-embedding theory. 4 | 5 | Collaborators can contribute by raising **issues**, or via **pull requests**. 6 | 7 | If you don't already have a favourite Git client installed, consider using [GitHub Desktop](http://desktop.github.com). 8 | 9 | 10 | --------------------------------------------------------------------------------