Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #551 from iglesias/so
SO Initiation
- Loading branch information
Showing
28 changed files
with
1,235 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Written (W) 2012 Fernando José Iglesias García | ||
* Copyright (C) 2012 Fernando José Iglesias García | ||
*/ | ||
|
||
#include <shogun/labels/StructuredLabels.h> | ||
|
||
using namespace shogun; | ||
|
||
CStructuredLabels::CStructuredLabels() | ||
: CLabels() | ||
{ | ||
init(); | ||
} | ||
|
||
CStructuredLabels::CStructuredLabels(int32_t num_labels) | ||
: CLabels() | ||
{ | ||
init(); | ||
m_labels = new CDynamicObjectArray(num_labels); | ||
SG_REF(m_labels); | ||
} | ||
|
||
CStructuredLabels::~CStructuredLabels() | ||
{ | ||
SG_UNREF(m_labels); | ||
} | ||
|
||
void CStructuredLabels::ensure_valid(const char* context) | ||
{ | ||
if ( m_labels == NULL ) | ||
SG_ERROR("Non-valid StructuredLabels"); | ||
} | ||
|
||
CDynamicObjectArray* CStructuredLabels::get_labels() const | ||
{ | ||
SG_REF(m_labels); | ||
return m_labels; | ||
} | ||
|
||
int32_t CStructuredLabels::get_num_labels() | ||
{ | ||
if ( m_labels == NULL ) | ||
return 0; | ||
else | ||
return m_labels->get_num_elements(); | ||
} | ||
|
||
void CStructuredLabels::init() | ||
{ | ||
SG_ADD((CSGObject**) &m_labels, "m_labels", "The labels", MS_NOT_AVAILABLE); | ||
|
||
m_labels = NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Written (W) 2012 Fernando José Iglesias García | ||
* Copyright (C) 2012 Fernando José Iglesias García | ||
*/ | ||
|
||
#ifndef _STRUCTURED_LABELS__H__ | ||
#define _STRUCTURED_LABELS__H__ | ||
|
||
#include <shogun/labels/Labels.h> | ||
#include <shogun/labels/LabelTypes.h> | ||
#include <shogun/lib/DynamicObjectArray.h> | ||
#include <shogun/lib/StructuredData.h> | ||
|
||
namespace shogun { | ||
|
||
class CStructuredLabels : public CLabels | ||
{ | ||
|
||
public: | ||
/** default constructor */ | ||
CStructuredLabels(); | ||
|
||
/** constructor | ||
* | ||
* @param num_labels number of labels | ||
*/ | ||
CStructuredLabels(int32_t num_labels); | ||
|
||
/** destructor */ | ||
~CStructuredLabels(); | ||
|
||
/** check if labeling is valid | ||
* | ||
* possible with subset | ||
* | ||
* @return if labeling is valid | ||
*/ | ||
virtual void ensure_valid(const char* context = NULL); | ||
|
||
/** get labels | ||
* | ||
* not possible with subset | ||
* | ||
* @return labels | ||
*/ | ||
CDynamicObjectArray* get_labels() const; | ||
|
||
/** get number of labels, depending on wheter a subset is set | ||
* | ||
* @return number of labels | ||
*/ | ||
virtual int32_t get_num_labels(); | ||
|
||
/** @return object name */ | ||
virtual const char* get_name() const { return "StructuredLabels"; } | ||
|
||
/** get label type | ||
* | ||
* @return label type LT_STRUCTURED | ||
*/ | ||
virtual ELabelType get_label_type() { return LT_STRUCTURED; } | ||
|
||
private: | ||
/** internal initialization */ | ||
void init(); | ||
|
||
private: | ||
/** the vector of labels */ | ||
CDynamicObjectArray* m_labels; | ||
|
||
}; /* class CStructuredLabels */ | ||
|
||
} /* namespace shogun */ | ||
|
||
#endif /* _STRUCTUREDLABELS_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Written (W) 2012 Fernando José Iglesias García | ||
* Copyright (C) 2012 Fernando José Iglesias García | ||
*/ | ||
|
||
#include <shogun/lib/StructuredData.h> | ||
|
||
using namespace shogun; | ||
|
||
/* TODO */ | ||
CStructuredData::CStructuredData() | ||
{ | ||
} | ||
|
||
/* TODO */ | ||
CStructuredData::~CStructuredData() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Written (W) 2012 Fernando José Iglesias García | ||
* Copyright (C) 2012 Fernando José Iglesias García | ||
*/ | ||
|
||
#ifndef _STRUCTUREDDATA_H__ | ||
#define _STRUCTUREDDATA_H__ | ||
|
||
#include <shogun/base/SGObject.h> | ||
|
||
namespace shogun | ||
{ | ||
|
||
class CStructuredData : public CSGObject | ||
{ | ||
|
||
public: | ||
/** default constructor */ | ||
CStructuredData(); | ||
|
||
/** destructor */ | ||
~CStructuredData(); | ||
|
||
/** @return object name */ | ||
inline virtual const char* get_name() const { return "StructuredData"; } | ||
|
||
}; | ||
|
||
} /* namespace shogun */ | ||
|
||
#endif /* _STRUCTUREDDATA_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.