<jupyter_start><jupyter_text>SELF ORGANIZING MAPS-:1.the intuition of SOMs2.how to build a SOM3.how to return the specific features(like frauds)detcted by SOM4.how to make a hybrid deep learning model .how do self organizing maps work.k-means clustering.SOMS(part1).SOMS(part2).live SOM example.reading an advanced somsom is used for-reducing the dimensioneg..multidimensional ds-reduce the dimensionality(no of rows and no of colums)`.how do work-i/p->make an map with a certain parameter->display the map with understandable features and a great visualization.k-means->gruoup the features within a numbar of cluster based upon the similarities of the parameter how k-maeans intuition->1.choose  k no of cluster                        2.select the random k ponits which is centriod                        3.assign the dataponit to the closest centroid-that fom s k cluster using eculidian dis                        4.compute the new centriod                        5.reassign the data ponit to new coloseset centriod ** quick hack-make an line between two choosen centriod  and above and below the data ponis are clostest to that dataponit resectivelystp 4 and stp5 repeat untill stopping criteriainput(3d)(soms)->output(2d)no activation (weights are cordinates(w1,w2,w3)i/p->{w1,w2,w3}->calculate the distances[sqrt((x1-w1)^2+(x2-w2)^2+(x3-w3)^2))]    for every hidden layer    eg.    3 i/p layer and 10 hidden layer(every one connected to every node row 1-the closest distence is called bmu-best matching unit then closest node will updated the weights and all nodes are closest to bmu bum uses radius -according to its distance to the different node it will upadtaed covinently row no2-.. row 3.. .. .. random nodes are likely to be colur to the appereance/proprety of each bmueach bmu has it won radius areaif 10 nodes are 10 bmu then ..all random nodes are aquire the shortest distance property from bmuall 10 nodes are aciure the 10 bum properties colouradv:.retain trhe topology of the i/p.revel the best co relation.classify the data without supervision.no target vector-no backpropagration.no connection between the output nodes(no ann connection,no activation) **`UCI machine learning labrotory(data set)`**<jupyter_code># Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

# Importing the dataset
dataset = pd.read_csv('/content/drive/My Drive/Colab Notebooks/Self_Organizing_Maps/Credit_Card_Applications.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values
dataset.head()

# Feature Scaling
from sklearn.preprocessing import MinMaxScaler
sc = MinMaxScaler(feature_range = (0, 1))
X = sc.fit_transform(X)
pip install minisom
# Training the SOM
from minisom import MiniSom
som = MiniSom(x = 10, y = 10, input_len = 15, sigma = 1.0, learning_rate = 0.5)
som.random_weights_init(X)
som.train_random(data = X, num_iteration = 100)<jupyter_output><empty_output><jupyter_text>MID-MEAN INTERNEURON DISTANCE:higher mid->more wining node are outlier<jupyter_code># Visualizing the results
from pylab import bone, pcolor, colorbar, plot, show
bone()
pcolor(som.distance_map().T)
colorbar()
markers = ['o', 's']
colors = ['r', 'g']
for i, x in enumerate(X):
    w = som.winner(x)
    plot(w[0] + 0.5,
         w[1] + 0.5,
         markers[y[i]],
         markeredgecolor = colors[y[i]],
         markerfacecolor = 'None',
         markersize = 10,
         markeredgewidth = 2)
show()
# Finding the frauds
mappings = som.win_map(X)

frauds = np.concatenate((mappings[(8,1)], mappings[(6,8)]), axis = 0)

frauds.reshape(-1,1)
frauds = sc.inverse_transform(frauds)

frauds<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08897379912663755, 'fraction_numerical': 0.02101528384279476, 'mean_word_length': 4.083217753120666, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '132464', 'license': 'MIT', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1137, 'n_words': 419, 'path': 'SOM.ipynb', 'repo_name': 'abegpatel/Fraud-detection-using-self-organizing-maps', 'size': '3664'}