DiSMEC++
prediction.h
Go to the documentation of this file.
1 // Copyright (c) 2021, Aalto University, developed by Erik Schultheis
2 // All rights reserved.
3 //
4 // SPDX-License-Identifier: MIT
5 
6 #ifndef DISMEC_IO_PREDICTION_H
7 #define DISMEC_IO_PREDICTION_H
8 
9 #include <filesystem>
10 #include "matrix_types.h"
11 
13 {
14  using std::filesystem::path;
27  void save_sparse_predictions(const path& target,
28  const PredictionMatrix& values,
29  const IndexMatrix& indices);
30 
32  void save_sparse_predictions(std::ostream& target,
33  const PredictionMatrix& values,
34  const IndexMatrix& indices);
35 
44  std::pair<IndexMatrix, PredictionMatrix> read_sparse_prediction(std::istream& source);
45 
47  std::pair<IndexMatrix, PredictionMatrix> read_sparse_prediction(const path& source);
48 
54  void save_dense_predictions_as_txt(const path& target, const PredictionMatrix& values);
55 
57  void save_dense_predictions_as_txt(std::ostream& target, const PredictionMatrix& values);
63  void save_dense_predictions_as_npy(const path& target, const PredictionMatrix& values);
64 
66  void save_dense_predictions_as_npy(std::ostream& target, const PredictionMatrix& values);
67 }
68 
69 #endif //DISMEC_IO_PREDICTION_H
void save_dense_predictions_as_txt(const path &target, const PredictionMatrix &values)
Saves predictions as a dense txt matrix.
void save_dense_predictions_as_npy(const path &target, const PredictionMatrix &values)
Saves predictions as a dense npy file.
std::pair< IndexMatrix, PredictionMatrix > read_sparse_prediction(std::istream &source)
Reads sparse predictions as saved by save_sparse_predictions().
void save_sparse_predictions(const path &target, const PredictionMatrix &values, const IndexMatrix &indices)
Saves sparse predictions as a text file.
types::DenseRowMajor< long > IndexMatrix
Matrix used for indices in sparse predictions.
Definition: matrix_types.h:81
types::DenseRowMajor< real_t > PredictionMatrix
Dense matrix in Row Major format used for predictions.
Definition: matrix_types.h:75