1601398800
Of course, of the first questions, we always ask in statistics is: “what is the trend/mean?” or “How does this behave on average”? In this article, we consider the problem of estimating the trend, along with its statistical properties. “Why bother?” — you may ask. By knowing its basic statistical properties such as **biasness ** and **consistency, ** we have a more theoretically based ground and quantitative measures to trust or not to trust our estimates. Indeed, if we cannot even be sure of how close to accurate our estimates are, why even bother using them?
#statistics #mathematics #machine-learning #forecasting #time-series-analysis
1649209980
A cross-platform command line REPL for the rapid experimentation and exploration of C#. It supports intellisense, installing NuGet packages, and referencing local .NET projects and assemblies.
(click to view animation)
C# REPL provides the following features:
C# REPL is a .NET 6 global tool, and runs on Windows 10, Mac OS, and Linux. It can be installed via:
dotnet tool install -g csharprepl
If you're running on Mac OS Catalina (10.15) or later, make sure you follow any additional directions printed to the screen. You may need to update your PATH variable in order to use .NET global tools.
After installation is complete, run csharprepl
to begin. C# REPL can be updated via dotnet tool update -g csharprepl
.
Run csharprepl
from the command line to begin an interactive session. The default colorscheme uses the color palette defined by your terminal, but these colors can be changed using a theme.json
file provided as a command line argument.
Type some C# into the prompt and press Enter to run it. The result, if any, will be printed:
> Console.WriteLine("Hello World")
Hello World
> DateTime.Now.AddDays(8)
[6/7/2021 5:13:00 PM]
To evaluate multiple lines of code, use Shift+Enter to insert a newline:
> var x = 5;
var y = 8;
x * y
40
Additionally, if the statement is not a "complete statement" a newline will automatically be inserted when Enter is pressed. For example, in the below code, the first line is not a syntactically complete statement, so when we press enter we'll go down to a new line:
> if (x == 5)
| // caret position, after we press Enter on Line 1
Finally, pressing Ctrl+Enter will show a "detailed view" of the result. For example, for the DateTime.Now
expression below, on the first line we pressed Enter, and on the second line we pressed Ctrl+Enter to view more detailed output:
> DateTime.Now // Pressing Enter shows a reasonable representation
[5/30/2021 5:13:00 PM]
> DateTime.Now // Pressing Ctrl+Enter shows a detailed representation
[5/30/2021 5:13:00 PM] {
Date: [5/30/2021 12:00:00 AM],
Day: 30,
DayOfWeek: Sunday,
DayOfYear: 150,
Hour: 17,
InternalKind: 9223372036854775808,
InternalTicks: 637579915804530992,
Kind: Local,
Millisecond: 453,
Minute: 13,
Month: 5,
Second: 0,
Ticks: 637579915804530992,
TimeOfDay: [17:13:00.4530992],
Year: 2021,
_dateData: 9860951952659306800
}
A note on semicolons: C# expressions do not require semicolons, but statements do. If a statement is missing a required semicolon, a newline will be added instead of trying to run the syntatically incomplete statement; simply type the semicolon to complete the statement.
> var now = DateTime.Now; // assignment statement, semicolon required
> DateTime.Now.AddDays(8) // expression, we don't need a semicolon
[6/7/2021 5:03:05 PM]
Use the #r
command to add assembly or nuget references.
#r "AssemblyName"
or #r "path/to/assembly.dll"
#r "path/to/project.csproj"
. Solution files (.sln) can also be referenced.#r "nuget: PackageName"
to install the latest version of a package, or #r "nuget: PackageName, 13.0.5"
to install a specific version (13.0.5 in this case).To run ASP.NET applications inside the REPL, start the csharprepl
application with the --framework
parameter, specifying the Microsoft.AspNetCore.App
shared framework. Then, use the above #r
command to reference the application DLL. See the Command Line Configuration section below for more details.
csharprepl --framework Microsoft.AspNetCore.App
The C# REPL supports multiple configuration flags to control startup, behavior, and appearance:
csharprepl [OPTIONS] [response-file.rsp] [script-file.csx] [-- <additional-arguments>]
Supported options are:
-r <dll>
or --reference <dll>
: Reference an assembly, project file, or nuget package. Can be specified multiple times. Uses the same syntax as #r
statements inside the REPL. For example, csharprepl -r "nuget:Newtonsoft.Json" "path/to/myproj.csproj"
-u <namespace>
or --using <namespace>
: Add a using statement. Can be specified multiple times.-f <framework>
or --framework <framework>
: Reference a shared framework. The available shared frameworks depends on the local .NET installation, and can be useful when running an ASP.NET application from the REPL. Example frameworks are:-t <theme.json>
or --theme <theme.json>
: Read a theme file for syntax highlighting. This theme file associates C# syntax classifications with colors. The color values can be full RGB, or ANSI color names (defined in your terminal's theme). The NO_COLOR standard is supported.--trace
: Produce a trace file in the current directory that logs CSharpRepl internals. Useful for CSharpRepl bug reports.-v
or --version
: Show version number and exit.-h
or --help
: Show help and exit.response-file.rsp
: A filepath of an .rsp file, containing any of the above command line options.script-file.csx
: A filepath of a .csx file, containing lines of C# to evaluate before starting the REPL. Arguments to this script can be passed as <additional-arguments>
, after a double hyphen (--
), and will be available in a global args
variable.If you have dotnet-suggest
enabled, all options can be tab-completed, including values provided to --framework
and .NET namespaces provided to --using
.
C# REPL is a standalone software application, but it can be useful to integrate it with other developer tools:
To add C# REPL as a menu entry in Windows Terminal, add the following profile to Windows Terminal's settings.json
configuration file (under the JSON property profiles.list
):
{
"name": "C# REPL",
"commandline": "csharprepl"
},
To get the exact colors shown in the screenshots in this README, install the Windows Terminal Dracula theme.
To use the C# REPL with Visual Studio Code, simply run the csharprepl
command in the Visual Studio Code terminal. To send commands to the REPL, use the built-in Terminal: Run Selected Text In Active Terminal
command from the Command Palette (workbench.action.terminal.runSelectedText
).
To add the C# REPL to the Windows Start Menu for quick access, you can run the following PowerShell command, which will start C# REPL in Windows Terminal:
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut("$env:appdata\Microsoft\Windows\Start Menu\Programs\csharprepl.lnk")
$shortcut.TargetPath = "wt.exe"
$shortcut.Arguments = "-w 0 nt csharprepl.exe"
$shortcut.Save()
You may also wish to add a shorter alias for C# REPL, which can be done by creating a .cmd
file somewhere on your path. For example, put the following contents in C:\Users\username\.dotnet\tools\csr.cmd
:
wt -w 0 nt csharprepl
This will allow you to launch C# REPL by running csr
from anywhere that accepts Windows commands, like the Window Run dialog.
This project is far from being the first REPL for C#. Here are some other projects; if this project doesn't suit you, another one might!
Visual Studio's C# Interactive pane is full-featured (it has syntax highlighting and intellisense) and is part of Visual Studio. This deep integration with Visual Studio is both a benefit from a workflow perspective, and a drawback as it's not cross-platform. As far as I know, the C# Interactive pane does not support NuGet packages or navigating to documentation/source code. Subjectively, it does not follow typical command line keybindings, so can feel a bit foreign.
csi.exe ships with C# and is a command line REPL. It's great because it's a cross platform REPL that comes out of the box, but it doesn't support syntax highlighting or autocompletion.
dotnet script allows you to run C# scripts from the command line. It has a REPL built-in, but the predominant focus seems to be as a script runner. It's a great tool, though, and has a strong community following.
dotnet interactive is a tool from Microsoft that creates a Jupyter notebook for C#, runnable through Visual Studio Code. It also provides a general framework useful for running REPLs.
Download Details:
Author: waf
Source Code: https://github.com/waf/CSharpRepl
License: MPL-2.0 License
1594653037
A Complete Introduction To Time Series Analysis (with R):: Tests for Stationarity
#complete #introduction #series #analysis #r #tests
1623292080
Time series analysis is the backbone for many companies since most businesses work by analyzing their past data to predict their future decisions. Analyzing such data can be tricky but Python, as a programming language, can help to deal with such data. Python has both inbuilt tools and external libraries, making the whole analysis process both seamless and easy. Python’s Panda s library is frequently used to import, manage, and analyze datasets in various formats. However, in this article, we’ll use it to analyze stock prices and perform some basic time-series operations.
#data-analysis #time-series-analysis #exploratory-data-analysis #stock-market-analysis #financial-analysis #getting started with time series using pandas
1601398800
Of course, of the first questions, we always ask in statistics is: “what is the trend/mean?” or “How does this behave on average”? In this article, we consider the problem of estimating the trend, along with its statistical properties. “Why bother?” — you may ask. By knowing its basic statistical properties such as **biasness ** and **consistency, ** we have a more theoretically based ground and quantitative measures to trust or not to trust our estimates. Indeed, if we cannot even be sure of how close to accurate our estimates are, why even bother using them?
#statistics #mathematics #machine-learning #forecasting #time-series-analysis
1594073100
This tutorial was supposed to be published last week. Except I couldn’t get a working (and decent) model ready in time to write an article about it. In fact, I’ve had to spend 2 days on the code to wrangle some semblance of useful and legible output from it.
But I’m not mad at it (now). This is the aim of my challenge here and truthfully I was getting rather tired of solving all the previous classification tasks in a row. And the good news is I’ve learned how to model the data in a suitable format for processing, conducting exploratory data analysis on time-series data and building a good (the best I could come up with, like, after 2 days) model.
So I’ve also made a meme to commemorate my journey. I promise the tutorial is right on the other side of it.
Yes, I made a meme of my own code.
_About the Dataset: __The Gas Sensor Array Dataset, download from here**, _**consists of 8 sensor readings all set to detect concentration levels of a mixture of Ethylene gas with either Methane or Carbon Monoxide. The concentration levels are constantly changing with time and the sensors record this information.
Regression is one other possible type of solution that can be implemented for this dataset, but I deliberately chose to build a multivariate time-series model to familiarize myself with time-series forecasting problems and also to set more of a challenge to myself.
Time-Series data continuosuly varies with time. There may be one variable that does so (univariate), or multiple variables that vary with time (multivariate) in a given dataset.
Here, there are 11 feature variables in total; 8 sensor readings (time-dependent), Temperature, Relative Humidity and the Time (stamp) at which the recordings were observed.
As with most datasets in the UCI Machine Learning Repository, you will have to spend time cleaning up the flat files, converting them to a CSV format and insert the column headers at the top.
If this sounds exhausting to you, you can simply downloadone such file I’ve already prepped.
T
his is going to be a long tutorial with explanations liberally littered here and there, in order to explain concepts that most beginners might not be knowing. So in advance, thank you for your patience and I’ll keep the explanations to the point and as short as possible.
Before heading into the data preprocessing part, it is important to visualize what variables are changing with time and how they are changing (trends) with time. Here’s how.
Time Series Data Plot
# Gas Sensing Array Forecast with VAR model
# Importing libraries
import numpy as np, pandas as pd
import matplotlib.pyplot as plt, seaborn as sb
# Importing Dataset
df = pd.read_csv("dataset.csv")
ds = df.drop(['Time'], axis = 1)
# Visualize the trends in data
sb.set_style('darkgrid')
ds.plot(kind = 'line', legend = 'reverse', title = 'Visualizing Sensor Array Time-Series')
plt.legend(loc = 'upper right', shadow = True, bbox_to_anchor = (1.35, 0.8))
plt.show()
# Dropping Temperature & Relative Humidity as they do not change with Time
ds.drop(['Temperature','Rel_Humidity'], axis = 1, inplace = True)
# Again Visualizing the time-series data
sb.set_style('darkgrid')
ds.plot(kind = 'line', legend = 'reverse', title = 'Visualizing Sensor Array Time-Series')
plt.legend(loc = 'upper right', shadow = True, bbox_to_anchor = (1.35, 0.8))
plt.show()
view raw
gsr_data_prepocessing.py hosted with ❤ by GitHub
It is evident that the ‘Temperature’ and ‘Relative Humidity’ variables do not really change with time at all. Therefore I have dropped the columns; time, temperature and rel_humidity from the dataset, to ensure that it only contains pure, time-series data.
Non-stationary data has trends that are present in the data. We will have to eliminate this property because the Vector Autoregression (VAR) model, requires the data to be stationary.
A Stationary series is one whose mean and variance do not change with time.
One of the ways to check for stationarity is the ADF test. The ADF test has to be implemented for all the 8 sensor readings column. We’ll also split the data into train & test subsets.
#multivariate-analysis #time-series-forecasting #data-science #machine-learning #time-series-analysis #data analysis