1#ifndef SINGLEPP_TRAIN_SINGLE_HPP
2#define SINGLEPP_TRAIN_SINGLE_HPP
7#include "tatami/tatami.hpp"
9#include "build_indices.hpp"
10#include "subset_to_markers.hpp"
27template<
typename Index_ = DefaultIndex,
typename Float_ = DefaultFloat>
43 std::shared_ptr<knncolle::Builder<knncolle::SimpleMatrix<Index_, Index_, Float_>,
Float_> >
trainer;
57template<
typename Value_,
typename Index_,
typename Label_,
typename Float_>
59 const tatami::Matrix<Value_, Index_>&
ref,
61 const std::vector<Index_>&
subset,
86template<
typename Index_,
typename Float_>
94 std::vector<Index_>
subset,
95 std::vector<internal::PerLabelReference<Index_, Float_> >
references) :
97 my_subset(std::move(
subset)),
106 std::vector<Index_> my_subset;
107 std::vector<internal::PerLabelReference<Index_, Float_> > my_references;
132 return my_references.size();
140 for (
const auto&
ref : my_references) {
141 n +=
ref.ranked.size();
150 return my_references;
180template<
typename Value_,
typename Index_,
typename Label_,
typename Float_>
182 const tatami::Matrix<Value_, Index_>&
ref,
202template<
typename Index_,
typename Float_>
212 std::vector<internal::PerLabelReference<Index_, Float_> >
references) :
213 my_markers(std::move(
markers)),
224 std::vector<Index_> my_test_subset;
225 std::vector<Index_> my_ref_subset;
226 std::vector<internal::PerLabelReference<Index_, Float_> > my_references;
245 return my_test_subset;
254 return my_ref_subset;
261 return my_references.size();
269 for (
const auto&
ref : my_references) {
270 n +=
ref.ranked.size();
279 return my_references;
310template<
typename Index_,
typename Value_,
typename Label_,
typename Float_>
313 const tatami::Matrix<Value_, Index_>&
ref,
351template<
typename Index_,
typename Id_,
typename Value_,
typename Label_,
typename Float_>
355 const tatami::Matrix<Value_, Index_>&
ref,
Classifier built from an intersection of genes.
Definition train_single.hpp:203
const Markers< Index_ > & get_markers() const
Definition train_single.hpp:235
const std::vector< Index_ > & get_test_subset() const
Definition train_single.hpp:244
const std::vector< Index_ > & get_ref_subset() const
Definition train_single.hpp:253
size_t num_labels() const
Definition train_single.hpp:260
size_t num_profiles() const
Definition train_single.hpp:267
Classifier trained from a single reference.
Definition train_single.hpp:87
const std::vector< Index_ > & get_subset() const
Definition train_single.hpp:124
size_t num_labels() const
Definition train_single.hpp:131
size_t num_profiles() const
Definition train_single.hpp:138
const Markers< Index_ > & get_markers() const
Definition train_single.hpp:116
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
TrainedSingleIntersect< Index_, Float_ > train_single_intersect(const Intersection< Index_ > &intersection, const tatami::Matrix< Value_, Index_ > &ref, const Label_ *labels, Markers< Index_ > markers, const TrainSingleOptions< Index_, Float_ > &options)
Definition train_single.hpp:311
std::vector< std::vector< std::vector< Index_ > > > Markers
Definition Markers.hpp:40
TrainedSingle< Index_, Float_ > train_single(const tatami::Matrix< Value_, Index_ > &ref, const Label_ *labels, Markers< Index_ > markers, const TrainSingleOptions< Index_, Float_ > &options)
Definition train_single.hpp:181
Options for train_single() and friends.
Definition train_single.hpp:28
int num_threads
Definition train_single.hpp:49
std::shared_ptr< knncolle::Builder< knncolle::SimpleMatrix< Index_, Index_, Float_ >, Float_ > > trainer
Definition train_single.hpp:43
int top
Definition train_single.hpp:36