1#ifndef SINGLEPP_TRAIN_INTEGRATED_HPP
2#define SINGLEPP_TRAIN_INTEGRATED_HPP
6#include "scaled_ranks.hpp"
11#include <unordered_set>
12#include <unordered_map>
33template<
typename Value_ = DefaultValue,
typename Index_ = DefaultIndex,
typename Label_ = DefaultLabel>
38 const tatami::Matrix<Value_, Index_>*
ref;
42 std::vector<std::vector<Index_> >
markers;
72template<
typename Value_,
typename Index_,
typename Label_,
typename Float_>
74 const tatami::Matrix<Value_, Index_>&
ref,
91 std::unordered_set<Index_>
unified;
129template<
typename Index_,
typename Value_,
typename Label_,
typename Float_>
132 const tatami::Matrix<Value_, Index_>&
ref,
147 std::unordered_set<Index_>
unified;
164 output.with_intersection =
true;
195template<
typename Index_,
typename Id_,
typename Value_,
typename Label_,
typename Float_>
199 const tatami::Matrix<Value_, Index_>&
ref,
215template<
typename Index_>
254 std::vector<std::unordered_set<Index_> >
available;
255 std::vector<std::vector<std::vector<Index_> > >
markers;
256 std::vector<std::vector<std::vector<internal::RankedVector<Index_, Index_> > > >
ranked;
278template<
typename Value_,
typename Index_,
typename Input_>
291 if constexpr(std::is_const<Input_>::value) {
327 tatami::VectorPtr<Index_>
universe_ptr(tatami::VectorPtr<Index_>{}, &(
output.universe));
331 internal::RankedVector<Value_, Index_>
tmp_ranked;
384 internal::RankedVector<Value_, Index_>
tmp_ranked;
405template<
typename Value_,
typename Index_,
typename Inputs_>
424 std::sort(
output.universe.begin(),
output.universe.end());
430 for (
size_t r = 0;
r <
nrefs; ++
r) {
452template<
typename Value_,
typename Index_,
typename Label_>
454 return internal::train_integrated<Value_, Index_>(
inputs,
options);
467template<
typename Value_,
typename Index_,
typename Label_>
469 return internal::train_integrated<Value_, Index_>(
inputs,
options);
Create an intersection of genes.
Classifier that integrates multiple reference datasets.
Definition train_integrated.hpp:216
size_t num_labels(size_t r) const
Definition train_integrated.hpp:229
size_t num_profiles(size_t r) const
Definition train_integrated.hpp:237
size_t num_references() const
Definition train_integrated.hpp:221
Common definitions for singlepp.
Cell type classification using the SingleR algorithm in C++.
Definition classify_single.hpp:19
TrainIntegratedInput< Value_, Index_, Label_ > prepare_integrated_input_intersect(const Intersection< Index_ > &intersection, const tatami::Matrix< Value_, Index_ > &ref, const Label_ *labels, const TrainedSingleIntersect< Index_, Float_ > &trained)
Definition train_integrated.hpp:130
Intersection< Index_ > intersect_genes(Index_ test_nrow, const Id_ *test_id, Index_ ref_nrow, const Id_ *ref_id)
Definition Intersection.hpp:54
TrainIntegratedInput< Value_, Index_, Label_ > prepare_integrated_input(const tatami::Matrix< Value_, Index_ > &ref, const Label_ *labels, const TrainedSingle< Index_, Float_ > &trained)
Definition train_integrated.hpp:73
std::vector< std::vector< std::vector< Index_ > > > Markers
Definition Markers.hpp:40
TrainedIntegrated< Index_ > train_integrated(const std::vector< TrainIntegratedInput< Value_, Index_, Label_ > > &inputs, const TrainIntegratedOptions &options)
Definition train_integrated.hpp:453
Options for train_integrated().
Definition train_integrated.hpp:265
int num_threads
Definition train_integrated.hpp:270
Train a classifier from a single reference.