Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize load csv 01 #735

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
76b8f71
first commit
stereomatchingkiss Jul 24, 2016
a479c4c
first commit
stereomatchingkiss Jul 24, 2016
f09c01b
use fast csv parser to load csv and tsv file
stereomatchingkiss Jul 24, 2016
068c439
1 : fix bug, did not put the data into the matrix properly
stereomatchingkiss Jul 24, 2016
69f8a81
use boost format and string operation to generate error messages
stereomatchingkiss Jul 24, 2016
1669a22
remove useless codes
stereomatchingkiss Jul 24, 2016
f848d8e
fix bug--wrong namespace
stereomatchingkiss Jul 24, 2016
9165f9e
change char array to std::string
stereomatchingkiss Jul 24, 2016
8330f78
1 : fix warning
stereomatchingkiss Aug 6, 2016
623d708
1 : refine preprocess guard
stereomatchingkiss Aug 6, 2016
e143213
remove duplicate header
stereomatchingkiss Aug 6, 2016
4bb002c
remove useless codes
stereomatchingkiss Aug 6, 2016
035da37
refine preprocess guard
stereomatchingkiss Aug 6, 2016
70f292e
add missed header
stereomatchingkiss Aug 6, 2016
871042d
remove duplicate header
stereomatchingkiss Aug 6, 2016
5a497e1
add missed header
stereomatchingkiss Aug 6, 2016
9b60921
add license
stereomatchingkiss Aug 6, 2016
3059b83
use another way to include header
stereomatchingkiss Aug 6, 2016
e915439
use dot template to call the function since original solution can not…
stereomatchingkiss Aug 6, 2016
42944fe
adjust format
stereomatchingkiss Aug 14, 2016
802b21a
refine preprocessor guard
stereomatchingkiss Aug 14, 2016
6d74a65
adjust format
stereomatchingkiss Aug 14, 2016
f67fa11
fix bug--function name errors
stereomatchingkiss Aug 14, 2016
da6ac2e
refine class name
stereomatchingkiss Aug 14, 2016
08739c2
fix type cast warning
stereomatchingkiss Aug 14, 2016
26f911a
add test for fast csv parser
stereomatchingkiss Aug 14, 2016
9487e0b
fix bug--wrong namespace
stereomatchingkiss Aug 26, 2016
1e13c4b
fix warnings
stereomatchingkiss Aug 26, 2016
14e8283
include missed header
stereomatchingkiss Aug 26, 2016
5687076
const correctness
stereomatchingkiss Aug 26, 2016
cc87e08
add test cases for csv_reader
stereomatchingkiss Sep 3, 2016
b05d054
remove useless data member and adjust style
stereomatchingkiss Sep 6, 2016
356a797
add new test ParseLineTest
stereomatchingkiss Sep 8, 2016
64259a5
1 : add new policy NoQuoteEscapes, able to separate text with variabl…
stereomatchingkiss Sep 9, 2016
5a6b0c6
implement LoadARFF without DatasetInfo
stereomatchingkiss Sep 9, 2016
ac6f46c
add NoMappingARFFTest
stereomatchingkiss Sep 9, 2016
b9c5b7d
merge from master branch
stereomatchingkiss Sep 9, 2016
2e38924
use inline to avoid symbol confliction
stereomatchingkiss Sep 9, 2016
3fafb8f
replace multiple spaces to one space when parsing arff
stereomatchingkiss Sep 9, 2016
732de6b
avoid recreation of regex object
stereomatchingkiss Sep 9, 2016
37477ff
boost xpressive to replace std regex since there are some bugs when u…
stereomatchingkiss Sep 9, 2016
41a7166
switch back to std regex since xpressive need long compile time
stereomatchingkiss Sep 9, 2016
7252e2d
fix type mismatch
stereomatchingkiss Sep 9, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mlpack/core/data/file_reader/csv_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#ifndef MLPACK_CORE_DATA_FILE_READER_CSV_READER_HPP
#define MLPACK_CORE_DATA_FILE_READER_CSV_READER_HPP

#include "line_reader.hpp"
#include "parser.hpp"
#include <mlpack/core/data/file_reader/line_reader.hpp>
#include <mlpack/core/data/file_reader/parser.hpp>

#include <boost/tokenizer.hpp>
#include <boost/algorithm/string.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/mlpack/core/data/file_reader/line_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef MLPACK_CORE_DATA_FILE_READER_LINE_READER_HPP
#define MLPACK_CORE_DATA_FILE_READER_LINE_READER_HPP

#include "reader_exceptions.hpp"
#include <mlpack/core/data/file_reader/reader_exceptions.hpp>

#include <cstring>
#include <algorithm>
Expand Down
6 changes: 3 additions & 3 deletions src/mlpack/core/data/file_reader/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef MLPACK_CORE_DATA_FILE_READER_PARSER_HPP
#define MLPACK_CORE_DATA_FILE_READER_PARSER_HPP

#include "policy.hpp"
#include <mlpack/core/data/file_reader/policy.hpp>

#include <limits>
#include <vector>
Expand Down Expand Up @@ -115,7 +115,7 @@ void ParseUnsignedInteger(const char *col, T &x){
if('0' <= *col && *col <= '9'){
T y = *col - '0';
if(x > (std::numeric_limits<T>::max()-y)/10){
OverFlowPolicy::OnOverFlow(x);
OverFlowPolicy().template OnOverFlow<T>(x);
return;
}
x = 10*x+y;
Expand Down Expand Up @@ -147,7 +147,7 @@ void ParseSignedInteger(const char *col, T &x){
if('0' <= *col && *col <= '9'){
T y = *col - '0';
if(x < (std::numeric_limits<T>::min()+y)/10){
OverFlowPolicy::OnUnderFlow(x);
OverFlowPolicy().template OnUnderFlow<T>(x);
return;
}
x = 10*x-y;
Expand Down
33 changes: 32 additions & 1 deletion src/mlpack/core/data/file_reader/policy.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
// Copyright: (2012-2015) Ben Strasser <code@ben-strasser.net>
// License: BSD-3
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
//2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
//3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#ifndef MLPACK_CORE_DATA_FILE_READER_POLICY_HPP
#define MLPACK_CORE_DATA_FILE_READER_POLICY_HPP

#include "reader_exceptions.hpp"
#include <mlpack/core/data/file_reader/reader_exceptions.hpp>

namespace mlpack{

Expand Down