Skip to content

Instantly share code, notes, and snippets.

View ialexpovad's full-sized avatar
:electron:
I may be slow to respond.

nystagmus ialexpovad

:electron:
I may be slow to respond.
View GitHub Profile
@ialexpovad
ialexpovad / calcSqrEucleanDistance.py
Last active December 27, 2022 07:29
Сalculate squared euclidean distance matrices in Python.
# Several ways to calculate squared Euclidean Distance (Frobenius norm) matrices in Python
# Import modules first:
## import numpy module
import numpy as np
## import numpy linear algebra module
import numpy.linalg as la
## import scipy spatial module
import scipy.spatial as spt
std::vector<std::vector<float>> Read_Iris_Dataset(void)
{
std::ifstream myfile("iris.data");
std::string line;
std::vector<std::vector<float>> Iris_Dataset;
std::vector<float> temp_sepal_len;
std::vector<float> temp_sepal_wid;
std::vector<float> temp_petal_len;
std::vector<float> temp_petal_wid;
std::vector<float> temp_iris_class;
@ialexpovad
ialexpovad / ifcm.go
Created January 11, 2023 06:20
Intuitionistic fuzzy C-means algorithm based on membership information transferring and similarity measurements (IFCM)
package ifcm
import (
"fmt"
"math"
"sort"
)
//Interval
type Interval struct {
@ialexpovad
ialexpovad / gaussian.py
Created February 9, 2023 07:46
Plotting a Gaussian normal curve with Python and Matplotlib
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
# define constants
mu = 998.8
sigma = 73.10
x1 = 900
x2 = 1100
# calculate the z-transform
@ialexpovad
ialexpovad / sc.py
Last active February 17, 2023 06:21
Subtractive Clustering Algorithm according to "Learning of fuzzy rules by mountain clustering" by Ronald R. Yager and Dimitar P. Filev.
'''
Subtractive Clustering Algorithm according to "Learning of fuzzy rules by mountain clustering" by Ronald R. Yager and Dimitar P. Filev.
'''
__author__ = 'Alex Povod'
__version__ = '0.1.1'
import numpy
import numpy.typing as npt
import scipy as sp
@ialexpovad
ialexpovad / ridgeclass.py
Created February 17, 2023 07:04
Ridge Classifier Python Example
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.linear_model import RidgeClassifier
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
#
# Load IRIS dataset
#
@ialexpovad
ialexpovad / fcm.py
Created February 17, 2023 07:08
Implementation Fuzzy C-Means Algorithm
# %% [markdown]
# # Fuzzy C-Means Clustering
# %%
import re
import sys
import datetime
import os
import math
exceptions = (TypeError , SyntaxError, re.error, AttributeError , ValueError , NotImplementedError , Exception , RuntimeError , ImportError)
#define length(array) ((sizeof(array)) / (sizeof(array[0])))
type yourArray[] = {your, values};
length(yourArray); // returns length of yourArray
#include <stdlib.h>
#include <stdio.h>
#define length(array) ((sizeof(array)) / (sizeof(array[0])))
int main()
#include "utest.h"
#include <string>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <vector>
@ialexpovad
ialexpovad / Base.cs
Created April 12, 2023 13:42 — forked from weeksdev/Base.cs
WPF MVVM Binding Example
class Base : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
this.VerifyPropertyName(propertyName);
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null)
{