小编use*_*597的帖子

如何在我的Mac上安装pip3?

我正在尝试安装pip3,但我没有运气.此外,我试过sudo install,它没有用.我怎么能在我的Mac上安装pip3?

sudo easy_install pip3
Password:
Searching for pip3
Reading https://pypi.python.org/simple/pip3/
Couldn't find index page for 'pip3' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/

No local packages or download links found for pip3
error: Could not find suitable distribution for Requirement.parse('pip3')
Run Code Online (Sandbox Code Playgroud)

python pip python-3.x

132
推荐指数
9
解决办法
22万
查看次数

在 Python 中实现梯度下降并收到溢出错误

梯度下降和溢出错误

我目前正在 python 中实现向量化梯度下降。但是,我仍然收到溢出错误。不过,我的数据集中的数字并不是很大。我正在使用这个公式:

矢量化梯度下降的公式 我选择此实现是为了避免使用衍生工具。有人对如何解决这个问题有任何建议还是我实施错误?先感谢您!

数据集链接:https://www.kaggle.com/CooperUnion/anime-recommendations-database/data

## Cleaning Data ##
import math
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

data = pd.read_csv('anime.csv')
# print(data.corr())
# print(data['members'].isnull().values.any()) # Prints False
# print(data['rating'].isnull().values.any()) # Prints True

members = [] # Corresponding fan club size for row 
ratings = [] # Corresponding rating for row

for row in data.iterrows():
    if not math.isnan(row[1]['rating']): # Checks for Null ratings
        members.append(row[1]['members'])
        ratings.append(row[1]['rating'])


plt.plot(members, ratings)
plt.savefig('scatterplot.png')

theta0 = 0.3 # Random …
Run Code Online (Sandbox Code Playgroud)

python artificial-intelligence machine-learning gradient-descent loss-function

3
推荐指数
1
解决办法
3983
查看次数