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>
40 const tatami::Matrix<Value_, Index_>*
ref;
44 std::vector<std::vector<Index_> >
markers;
74template<
typename Value_,
typename Index_,
typename Label_,
typename Float_>
76 const tatami::Matrix<Value_, Index_>&
ref,
94 std::unordered_set<Index_>
unified;
134template<
typename Index_,
typename Value_,
typename Label_,
typename Float_>
138 const tatami::Matrix<Value_, Index_>&
ref,
154 std::unordered_set<Index_>
unified;
171 output.with_intersection =
true;
180template<
typename Index_,
typename Value_,
typename Label_,
typename Float_>
183 const tatami::Matrix<Value_, Index_>&
ref,
219template<
typename Index_,
typename Id_,
typename Value_,
typename Label_,
typename Float_>
223 const tatami::Matrix<Value_, Index_>&
ref,
239template<
typename Index_>
279 std::vector<std::unordered_set<Index_> >
available;
280 std::vector<std::vector<std::vector<Index_> > >
markers;
281 std::vector<std::vector<std::vector<internal::RankedVector<Index_, Index_> > > >
ranked;
303template<
typename Value_,
typename Index_,
typename Input_>
316 if constexpr(std::is_const<Input_>::value) {
352 tatami::VectorPtr<Index_>
universe_ptr(tatami::VectorPtr<Index_>{}, &(
output.universe));
356 internal::RankedVector<Value_, Index_>
tmp_ranked;
409 internal::RankedVector<Value_, Index_>
tmp_ranked;
430template<
typename Value_,
typename Index_,
typename Inputs_>
444 }
else if (
in.test_nrow !=
static_cast<Index_>(-1) &&
in.test_nrow !=
output.test_nrow) {
445 throw std::runtime_error(
"inconsistent number of rows in the test dataset across entries of 'inputs'");
459 std::sort(
output.universe.begin(),
output.universe.end());
465 for (
size_t r = 0;
r <
nrefs; ++
r) {
487template<
typename Value_,
typename Index_,
typename Label_>
489 return internal::train_integrated<Value_, Index_>(
inputs,
options);
502template<
typename Value_,
typename Index_,
typename Label_>
504 return internal::train_integrated<Value_, Index_>(
inputs,
options);
Create an intersection of genes.
Classifier that integrates multiple reference datasets.
Definition train_integrated.hpp:240
size_t num_labels(size_t r) const
Definition train_integrated.hpp:253
size_t num_profiles(size_t r) const
Definition train_integrated.hpp:261
size_t num_references() const
Definition train_integrated.hpp:245
Common definitions for singlepp.
Cell type classification using the SingleR algorithm in C++.
Definition classify_single.hpp:19
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:75
TrainIntegratedInput< Value_, Index_, Label_ > prepare_integrated_input_intersect(Index_ test_nrow, const Intersection< Index_ > &intersection, const tatami::Matrix< Value_, Index_ > &ref, const Label_ *labels, const TrainedSingleIntersect< Index_, Float_ > &trained)
Definition train_integrated.hpp:135
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:488
Options for train_integrated().
Definition train_integrated.hpp:290
int num_threads
Definition train_integrated.hpp:295
Train a classifier from a single reference.