Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

change the python code to R code (especially, numpy and seaborn ) [closed]

$
0
0

Hopefully, I would like to change the python code below to 'R code'.

==============================================

import numpy as np

xd = np.float32(np.random.rand(2,100))
yd=  np.dot([ 0.1, 0.2], xd) + 0.3

w = tf.Variable(tf.random_uniform([1,2],-1.0,1.0))
b = tf.Variable(2.5)
y = tf.matmul(w,xd) + b

loss =  tf.reduce_mean(tf.square(y-yd))
train = tf.train.GradientDescentOptimizer(0.5).minimize(loss)

sess = tf.Session()
sess.run(tf.global_variables_initializer())

for k in range(0,201): 
    sess.run(train)
    if k % 20 == 0 :
        print (k, sess.run(w), sess.run(b))

==============================================

DNN for iris data

import seaborn as sns

import pandas as pd

import numpy as np 
import matplotlib.pyplot as plt

iris = sns.load_dataset("iris")
iris.info()
SP = iris['species'].unique()
SP
iris.head()
sns.pairplot(iris, hue="species", palette="husl") 
sns.set()
sns.palplot(sns.color_palette())

==============================================

plt.style.available

plt.style.use('ggplot')

sns.set(style="ticks", color_codes=True)

==============================================


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>