Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
med:lab_2 [2019/03/12 16:04]
pszwed [Knowledge Explorer]
med:lab_2 [2022/03/06 23:01]
pszwed [Knowledge Explorer]
Line 1: Line 1:
-===== Metody Eksploracji Danych: Laboratorium 2 =====+===== Eksploracja Danych: Laboratorium 2 =====
  
  {{:med:med-lab02.pdf|Opis zadań (PDF)}}  {{:med:med-lab02.pdf|Opis zadań (PDF)}}
Line 22: Line 22:
      
   *Argumenty przekształceń   *Argumenty przekształceń
-     *Copy - ''1'' lub ''first'' +       *Copy - ''1'' lub ''first'' 
-     *Rename Find: ''Copy of X'' replace: ''X2'' +       *Rename Find: ''Copy of X'' replace: ''X2'' 
-     *Reorder  - podaje permutację, czyli ''1,3,2'' +       *Reorder  - podaje permutację, czyli ''1,3,2'' 
-     *MathExpression: expression: ''A*A'' ,ignore range ''1,3'' +       *MathExpression: expression: ''A*A'' ,ignore range ''1,3'' 
  
  
Line 47: Line 47:
   * Punkt 2.5 :!: W tej wersji Weka grupowanie nie działa   * Punkt 2.5 :!: W tej wersji Weka grupowanie nie działa
  
 +---
 +<code python>
 +from keras import layers
 +from keras import models
 +from keras.models import Sequential,InputLayer
 +from keras.layers import Dense
 +from io import StringIO
  
 +import tensorflow as tf
 +import matplotlib.pyplot as plt
 +import numpy as np
 +
 +# 005.arff
 +data = """
 +-4.84295,-27.856212
 +...
 +"""
 +#enter data as a string
 +inp =  StringIO(data)
 +x, y = np.loadtxt(inp, delimiter=',', usecols=(0, 1), unpack=True,skiprows=0)
 +X = np.stack((x,x**2,x**3),axis=-1)
 +
 +tf.random.set_seed(1)
 +model = models.Sequential()
 +model.add(layers.InputLayer(input_shape=(X.shape[1],)))
 +model.add(layers.Dense(1))
 +model.summary()
 +model.compile(optimizer=tf.keras.optimizers.RMSprop(????), loss='mse', metrics=['mse','mae'])
 +hist = model.fit(X,y,epochs=???,verbose=1)
 +
 +
 +y_pred = model.predict(X)
 +
 +plt.scatter(x,y)
 +plt.plot(x,(x+4)*(x+1)*(x-3),c='g')
 +plt.plot(x,y_pred,c='r')
 +
 +</code>
med/lab_2.txt · Last modified: 2022/03/10 16:48 by pszwed
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0