TimeSeriesAnalyzer 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +88 -18
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afe5e55449bead7c4122c26277c7316ba1954904037c0e6bda307f4010243072
4
- data.tar.gz: f019bf24421e06de735dc309393f3a2ebcc7ba7916171951b8e2d5a7176f401e
3
+ metadata.gz: 981015ef45222f0f9e674f4b2fe73ba988f0c118eaaaad5ee53fe07b59cc0721
4
+ data.tar.gz: 8697be20bf0edf3a7acea9fbcc1471f1fed58a60a4d66900805920d3298af0e2
5
5
  SHA512:
6
- metadata.gz: cf1832b2d79731f1b813e2978213068473a3c3f2991bff329d404a92e06837f97de0fc31355b1a0ecd96b16109e7e500df4df90944e091d1fc67a21782b3f672
7
- data.tar.gz: 02acea803ec3c301ac9998c5e771a6b468493904a1a5b7a851dbfaca9795ec3a44e7f70689076f7652f721c345f3c2e2d30b9e03babde733ef66d813cd0e51e7
6
+ metadata.gz: 18b3fa937f73beef940e540b3e75a851cb76ee7e536b0ce759c487ef20afd0bfea774a283ddc7a9e4120d1104d827cfb1bcfbe0acfa7e233cb7948ae0a109a66
7
+ data.tar.gz: 52fe905ca00a582a17a623d5008b01e34de3b6c5d97c1f5384fa0a82b705c4f51c7a5b8df6d55c3f0b2f9084d3107ab5f7d7eb3730fadc55ce796e3c327a37ef
data/README.md CHANGED
@@ -2,36 +2,106 @@
2
2
 
3
3
  [![Testing](https://github.com/sinatra/sinatra/actions/workflows/test.yml/badge.svg)](https://github.com/KuryataDanil/TimeSeriesAnalyzer/actions/workflows/main.yml)
4
4
 
5
-
6
- TODO: Delete this and the text below, and describe your gem
7
-
8
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/TimeSeriesAnalyzer`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ TimeSeriesAnalyzer is designed for solving and visualizing numerical series
9
6
 
10
7
  ## Installation
11
8
 
12
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
13
-
14
- Install the gem and add to the application's Gemfile by executing:
9
+ ```shell
10
+ gem install TimeSeriesAnalyzer
11
+ ```
15
12
 
16
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
13
+ The rmagick gem must be installed for it to work properly https://imagemagick.org/script/download.php#windows
17
14
 
18
- If bundler is not being used to manage dependencies, install the gem by executing:
15
+ <img width="75%" src="https://github.com/rmagick/rmagick/assets/199156/494e7963-cca5-4cb5-b28a-6c4d76adce5d" />
19
16
 
20
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
17
+ Then you need to go to the project terminal
18
+ ```shell
19
+ set CPATH="C:\Program Files (x86)\ImageMagick-[VERSION]-Q16\include"
20
+ set LIBRARY_PATH="C:\Program Files (x86)\ImageMagick-[VERSION]-Q16\lib"
21
+ em install rmagick
22
+ ```
21
23
 
22
24
  ## Usage
23
25
 
24
- TODO: Write usage instructions here
25
-
26
- ## Development
27
-
28
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
-
30
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+ Uploading data from a CSV file:
27
+ ```ruby
28
+ time_series = TimeSeriesAnalyzer::TimeSeries.load_from_csv(file_path)
29
+ # the second variable "period" determines the seasonality of the data
30
+ # by default -1, which means the seasonality is determined automatically
31
+ ```
32
+
33
+ Visualization of a time series:
34
+ ```ruby
35
+ time_series.plot(file_name)
36
+ # the second variable "title" indicates the title of the graph
37
+ ```
38
+
39
+ Decomposition of a time series:
40
+ ```ruby
41
+ decomposed = time_series.decompose
42
+
43
+ print(decomposed[:trend].data) # trend
44
+ puts ""
45
+ print(decomposed[:seasonal].data) # seasonal component
46
+ puts ""
47
+ print(decomposed[:residual].data) # remains
48
+ puts ""
49
+
50
+ decomposed[:trend].plot('trend.png')
51
+ decomposed[:seasonal].plot('seasonal.png')
52
+ decomposed[:residual].plot('residual.png')
53
+ ```
54
+
55
+ Application of the moving average:
56
+ ```ruby
57
+ moving_average(window_size)
58
+ #Returns a numeric series representing the moving average of the original
59
+ #parameter window_size is the size
60
+
61
+
62
+ smoothed_series = time_series.moving_average(3)
63
+ print(smoothed_series.data)
64
+ puts ""
65
+ smoothed_series.plot('moving_average.png')
66
+ ```
67
+
68
+ Applying exponential smoothing:
69
+ ```ruby
70
+ exponential_smoothing(alpha)
71
+ #Returns a numeric series representing the exponential smoothing of the original one
72
+ #The value of alpha represents the smoothing factor, which determines the weight of the current
73
+ #observation compared to the smoothed previous value.
74
+
75
+
76
+ smoothed_series = time_series.exponential_smoothing(0.3)
77
+ print(smoothed_series.data)
78
+ puts ""
79
+ smoothed_series.plot('exponential_smoothing.png')
80
+ ```
81
+
82
+ Anomaly detection:
83
+ ```ruby
84
+ detect_anomalies
85
+ #Function that returns detected anomalies in the numeric series
86
+ #Anomalies found are returned as dictionaries with timestamps and values.
87
+
88
+ anomalies = time_series.detect_anomalies
89
+ anomalies.each { |anomaly| puts "Anomaly detected at #{anomaly[:timestamp]}: #{anomaly[:value]}" }
90
+ ```
91
+
92
+ Forecasting:
93
+ ```ruby
94
+ forecast(steps)
95
+ #Function that predicts the following values (prediction based on the subsequent change of residues only)
96
+ #steps - number of steps for which it is necessary to forecast
97
+
98
+ forecasted_values = time_series.forecast(10)
99
+ puts "Forecasted values: #{forecasted_values}"
100
+ ```
31
101
 
32
102
  ## Contributing
33
103
 
34
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/TimeSeriesAnalyzer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/TimeSeriesAnalyzer/blob/master/CODE_OF_CONDUCT.md).
104
+ Bug reports and pull requests are welcome on GitHub at https://github.com/KuryataDanil/TimeSeriesAnalyzer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/KuryataDanil/TimeSeriesAnalyzer/blob/master/CODE_OF_CONDUCT.md).
35
105
 
36
106
  ## License
37
107
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TimeSeriesAnalyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - KuryataDanil