Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MODELS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tadah
MODELS
Commits
679c69f6
Commit
679c69f6
authored
1 year ago
by
mkirsz
Browse files
Options
Downloads
Patches
Plain Diff
More refactoring
parent
4b78a88a
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
m_base.h
+18
-18
18 additions, 18 deletions
m_base.h
m_blr_core.h
+11
-3
11 additions, 3 deletions
m_blr_core.h
m_core.h
+42
-1
42 additions, 1 deletion
m_core.h
m_krr_core.h
+11
-3
11 additions, 3 deletions
m_krr_core.h
with
82 additions
and
25 deletions
m_base.h
+
18
−
18
View file @
679c69f6
...
...
@@ -10,24 +10,24 @@ class M_Base {
public:
//Normaliser norm; // TODO?
virtual
~
M_Base
()
{};
/** \brief Predict local energy of an atom or bond energy.
*
* The result depends on how aed is computed.
*
* If it is computed between a pair of atoms than the result is a bond energy.
*
* If aed contains sum over all nearest neighbours than the result is
* a local atomic energy \f$ E_i \f$.
* */
virtual
double
epredict
(
const
aed_rctype
&
aed
)
=
0
;
/** \brief Predict force between a pair of atoms in a k-direction. */
virtual
double
fpredict
(
const
fd_type
&
fdij
,
const
aed_rctype
&
aedi
,
size_t
k
)
=
0
;
/** \brief Predict force between a pair of atoms. */
virtual
force_type
fpredict
(
const
fd_type
&
fdij
,
const
aed_rctype
&
aedi
)
=
0
;
//
//
/** \brief Predict local energy of an atom or bond energy.
//
*
//
* The result depends on how aed is computed.
//
*
//
* If it is computed between a pair of atoms than the result is a bond energy.
//
*
//
* If aed contains sum over all nearest neighbours than the result is
//
* a local atomic energy \f$ E_i \f$.
//
* */
//
virtual double epredict(const aed_rctype &aed)=0;
//
//
/** \brief Predict force between a pair of atoms in a k-direction. */
//
virtual double fpredict(const fd_type &fdij, const aed_rctype &aedi, size_t k)=0;
//
//
/** \brief Predict force between a pair of atoms. */
//
virtual force_type fpredict(const fd_type &fdij,
//
const aed_rctype &aedi)=0;
};
...
...
This diff is collapsed.
Click to expand it.
m_blr_core.h
+
11
−
3
View file @
679c69f6
...
...
@@ -11,13 +11,20 @@
template
<
class
BF
=
Function_Base
&
>
class
M_BLR_Core
:
public
virtual
M_Core
{
class
M_BLR_Core
:
public
virtual
M_Core
,
public
virtual
M_Predict
,
public
virtual
M_Train
{
public:
Config
&
config
;
//using M_Core<BF>::weights;
//using M_Core<BF>::trained;
//using M_Core<BF>::config;
mat
Sigma
;
Config
&
config
;
BF
bf
;
M_BLR_Core
(
Config
&
c
)
:
config
(
c
),
//M_Core<BF>(c),
bf
(
c
)
{
static_assert
(
std
::
is_base_of
<
BF_Base
,
BF
>::
value
,
...
...
@@ -31,6 +38,7 @@ class M_BLR_Core: public virtual M_Core {
M_BLR_Core
(
BF
&
bf
,
Config
&
c
)
:
config
(
c
),
//M_Core<BF>(bf,c),
bf
(
bf
)
{
if
(
dynamic_cast
<
BF_Base
*>
(
&
bf
)
==
nullptr
)
...
...
@@ -67,7 +75,7 @@ class M_BLR_Core: public virtual M_Core {
trained
=
true
;
}
M_Core
::
verbose
=
(
config
.
get
<
int
>
(
"VERBOSE"
));
verbose
=
(
config
.
get
<
int
>
(
"VERBOSE"
));
}
};
#endif
This diff is collapsed.
Click to expand it.
m_core.h
+
42
−
1
View file @
679c69f6
...
...
@@ -3,8 +3,21 @@
#include
"../CORE/typedefs.h"
//template
//<class F=Function_Base&>
class
M_Core
{
public:
// F f;
// Config &config;
//
// M_Core(Config &c):
// config(c),
// f(c)
// {}
// M_Core(F &f, Config &c):
// config(c),
// f(f)
// {}
int
verbose
;
bool
trained
=
false
;
t_type
weights
;
...
...
@@ -12,7 +25,6 @@ class M_Core {
virtual
~
M_Core
()
{}
virtual
double
predict
(
const
rvec
&
v
)
const
=
0
;
virtual
void
train
(
phi_type
&
Phi
,
const
t_type
&
T
)
=
0
;
virtual
t_type
get_weights_uncertainty
()
const
=
0
;
bool
is_trained
()
const
{
...
...
@@ -25,4 +37,33 @@ class M_Core {
weights
=
w
;
}
};
class
M_Predict
{
public:
virtual
~
M_Predict
()
{}
/** \brief Predict local energy of an atom or bond energy.
*
* The result depends on how aed is computed.
*
* If it is computed between a pair of atoms than the result is a bond energy.
*
* If aed contains sum over all nearest neighbours than the result is
* a local atomic energy \f$ E_i \f$.
* */
virtual
double
epredict
(
const
aed_rctype
&
aed
)
=
0
;
/** \brief Predict force between a pair of atoms in a k-direction. */
virtual
double
fpredict
(
const
fd_type
&
fdij
,
const
aed_rctype
&
aedi
,
size_t
k
)
=
0
;
/** \brief Predict force between a pair of atoms. */
virtual
force_type
fpredict
(
const
fd_type
&
fdij
,
const
aed_rctype
&
aedi
)
=
0
;
};
class
M_Train
{
public:
virtual
~
M_Train
()
{}
virtual
void
train
(
phi_type
&
Phi
,
const
t_type
&
T
)
=
0
;
};
#endif
This diff is collapsed.
Click to expand it.
m_krr_core.h
+
11
−
3
View file @
679c69f6
...
...
@@ -12,14 +12,21 @@
template
<
class
K
=
Function_Base
&
>
class
M_KRR_Core
:
public
virtual
M_Core
{
class
M_KRR_Core
:
public
virtual
M_Core
,
public
virtual
M_Predict
,
public
virtual
M_Train
{
public:
Config
&
config
;
//using M_Core<K>::weights;
//using M_Core<K>::trained;
//using M_Core<K>::config;
mat
Sigma
;
Config
&
config
;
K
kernel
;
EKM
<
K
>
ekm
;
M_KRR_Core
(
Config
&
c
)
:
config
(
c
),
//M_Core<K>(c),
kernel
(
c
),
ekm
(
c
)
{
...
...
@@ -33,6 +40,7 @@ class M_KRR_Core: public virtual M_Core {
M_KRR_Core
(
K
&
kernel
,
Config
&
c
)
:
config
(
c
),
//M_Core<K>(kernel, c),
kernel
(
kernel
),
ekm
(
kernel
)
{
...
...
@@ -75,7 +83,7 @@ class M_KRR_Core: public virtual M_Core {
trained
=
true
;
}
M_Core
::
verbose
=
(
config
.
get
<
int
>
(
"VERBOSE"
));
verbose
=
(
config
.
get
<
int
>
(
"VERBOSE"
));
}
};
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment