Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MarkovProcesses.jl
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
Bentriou Mahmoud
MarkovProcesses.jl
Commits
36713460
Commit
36713460
authored
4 years ago
by
Bentriou Mahmoud
Browse files
Options
Downloads
Patches
Plain Diff
new methods trajectory_from_csv
parent
708a6c40
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/MarkovProcesses.jl
+1
-1
1 addition, 1 deletion
core/MarkovProcesses.jl
core/trajectory.jl
+20
-0
20 additions, 0 deletions
core/trajectory.jl
with
21 additions
and
1 deletion
core/MarkovProcesses.jl
+
1
−
1
View file @
36713460
...
...
@@ -29,7 +29,7 @@ export InvariantPredicateFunction, CheckConstraintsFunction, UpdateStateFunction
# Trajectory related methods
export
+
,
-
,
δ
,
dist_lp
,
euclidean_distance
export
get_obs_var
,
length_states
,
length_obs_var
export
get_state_from_time
,
get_var_from_time
,
vectorize
export
get_state_from_time
,
get_var_from_time
,
vectorize
,
trajectory_from_csv
export
isbounded
,
states
,
times
,
transitions
export
check_consistency
,
issteadystate
,
isaccepted
...
...
This diff is collapsed.
Click to expand it.
core/trajectory.jl
+
20
−
0
View file @
36713460
...
...
@@ -308,3 +308,23 @@ function +(σ1::AbstractTrajectory,σ2::AbstractTrajectory) end
function
-(
σ1
::
AbstractTrajectory
,
σ2
::
AbstractTrajectory
)
end
δ
(
σ
::
AbstractTrajectory
,
idx
::
Int
)
=
times
(
σ
)[
i
+
1
]
-
times
(
σ
)[
i
]
function
trajectory_from_csv
(
csv_file
,
model
::
ContinuousTimeModel
)
csv_mat_values
,
header
=
readdlm
(
csv_file
,
','
,
header
=
true
)
nbr_states
=
size
(
csv_mat_values
,
1
)
times
=
zeros
(
nbr_states
)
values
=
Vector
{
Vector
{
Int
}}(
undef
,
length
(
model
.
g
))
transitions
=
fill
(
nothing
,
nbr_states
)
for
i
=
eachindex
(
header
)
model_var
=
header
[
i
]
if
model_var
==
"time"
times
=
csv_mat_values
[
:
,
i
]
elseif
model_var
==
"transitions"
transitions
=
csv_mat_values
[
:
,
i
]
else
@assert
Symbol
(
model_var
)
in
model
.
g
"Variable is not observed in the model"
values
[
model
.
_map_obs_var_idx
[
Symbol
(
model_var
)]]
=
csv_mat_values
[
:
,
i
]
end
end
return
Trajectory
(
model
,
values
,
times
,
transitions
)
end
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