180718 12:43:04 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 10048: Only one usage of each socket address (protocol/network address/port) is normally permitted.
180718 12:43:04 [ERROR] Do you already have another mysqld server running on port: 3306 ?
180718 12:43:04 [ERROR] Aborting
Run Code Online (Sandbox Code Playgroud)
有什么解决办法吗?Mysql 在基于 Windows 的服务器上运行。请给出最佳解决方案。。
我正在运行 kafka-connect 分布式设置。
我正在使用单机/进程设置(仍处于分布式模式)进行测试,效果很好,现在我正在使用 3 个节点(和 3 个连接进程),日志不包含错误,但是当我提交 s3-connector 时通过rest-api请求,它返回:{"error_code":409,"message":"Cannot complete request because of a conflicting operation (e.g. worker rebalance)"}。
当我停止其中一个节点上的 kafka-connect 进程时,我实际上可以提交作业并且一切正常。
我的集群中有 3 个代理,主题的分区号是 32。
这是我尝试启动的连接器:
{
"name": "s3-sink-new-2",
"config": {
"connector.class": "io.confluent.connect.s3.S3SinkConnector",
"tasks.max": "32",
"topics": "rawEventsWithoutAttribution5",
"s3.region": "us-east-1",
"s3.bucket.name": "dy-raw-collection",
"s3.part.size": "64000000",
"flush.size": "10000",
"storage.class": "io.confluent.connect.s3.storage.S3Storage",
"format.class": "io.confluent.connect.s3.format.avro.AvroFormat",
"schema.generator.class": "io.confluent.connect.storage.hive.schema.DefaultSchemaGenerator",
"partitioner.class": "io.confluent.connect.storage.partitioner.TimeBasedPartitioner",
"partition.duration.ms": "60000",
"path.format": "\'year\'=YYYY/\'month\'=MM/\'day\'=dd/\'hour\'=HH",
"locale": "US",
"timezone": "GMT",
"timestamp.extractor": "RecordField",
"timestamp.field": "procTimestamp",
"name": "s3-sink-new-2"
}
}
Run Code Online (Sandbox Code Playgroud)
日志中没有任何内容表明有问题,我真的迷失在这里。
我有一个包含200000个标记的训练样例的数据集.对于每个训练示例,我有10个功能,包括连续和离散.我正在尝试使用sklearnpython包来训练模型并进行预测,但我遇到了一些麻烦(还有一些问题).
首先让我编写我到目前为止编写的代码:
from sklearn.naive_bayes import GaussianNB
# data contains the 200 000 examples
# targets contain the corresponding labels for each training example
gnb = GaussianNB()
gnb.fit(data, targets)
predicted = gnb.predict(data)
Run Code Online (Sandbox Code Playgroud)
问题是我的准确度非常低(错误分类标签太多) - 大约20%.但是我不太确定数据是否存在问题(例如需要更多数据或其他内容)或代码.
在给定具有离散和连续特征的数据集的情况下,这是实现朴素贝叶斯分类器的正确方法吗?
此外,在机器学习中,我们知道数据集应该分为训练和验证/测试集.这是由模型使用训练数据集自动执行sklearn还是我应该使用验证集fit调用predict?
任何想法或建议将不胜感激.
当我使用kafka0.8.x时,我可以通过路径获取所有带有zookeeper的组列表/consumers/group_id,因为偏移将在0.8.x中提交到zookeeper.
但是在0.10.x的版本中,offset提交给kafka代理,就像一个路径/brokers/topics/__consumer_offsets和/consumerszookeeper中的路径一样.所以我无法通过zookeeper获得消费者群体列表.
apache-kafka kafka-consumer-api apache-zookeeper apache-kafka-connect
我正在开发一个项目,通过用户的推文来预测他的个性。
为了进行训练,我有一个包含 350000 条已接受性格测试的用户推文的大型语料库,每条推文都链接到特定的性格类型。有16种不同的性格类型(1-16)
我对此推文进行了预处理,以删除停用词、词干和词性标记。
我有一本包含 500 个最常用单词的大字典,我将用它作为我的训练特征。之后,我使用 500 个单词的预定义字典对每条推文执行 tfidf 向量化,为每条推文创建一个词向量。
vectorizer=TfidfVectorizer(vocabulary=mydict,min_df=1)
x=vectorizer.fit_transform(corpus).toarray()
Run Code Online (Sandbox Code Playgroud)
其中语料库是所有推文的列表。然后,我使用以下方法将其x与y(每条推文 1-16 个类)结合起来:
result=np.append(x,y,axis=1)
X=pandas.DataFrame(result)
X.to_csv('vectorized500.csv')
Run Code Online (Sandbox Code Playgroud)
我使用这个(350000*500)数据框作为X我的1-16编号的性格类型作为我的Y数据框(350000*1),它被平等地分为训练和测试:
X=pd.read_csv('vectorized500.csv')
train = X.sample(frac=0.8, random_state=200)
test=X.drop(train.index)
y_train=train["501"] #501 is the column name where Y is in the csv file
y_test=test["501"]
xtrain=train.drop("501",axis=1)
xtest=test.drop("501",axis=1)
Run Code Online (Sandbox Code Playgroud)
然而,无论我运行什么算法,我都会得到非常糟糕的结果:
model=RandomForestClassifier()
model.fit(xtrain,y_train)
pickle.dump(model, open('rf1000.sav', 'wb'))
print(model.score(xtest,y_test))
Run Code Online (Sandbox Code Playgroud)
如果我跑步RandomForestClassifier,我会得到 52% 的准确率。
如果我运行朴素贝叶斯、逻辑回归或线性 SVM,我会得到低于 20% 的准确度。
有没有有效的方法来运行这种多类文本分类,或者我做错了什么?准确率太低,我想提高它。
python machine-learning svm random-forest text-classification
我正在尝试将 MySQL 数据库连接到 Apache Superset,但报告了以下错误:
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'supersetuser'@'localhost' (using password: YES)")
Run Code Online (Sandbox Code Playgroud)
我正在使用 MAMP 和 MySQL 在端口 8889 上本地运行。我正在尝试apache_superset使用 user 的凭据连接数据库supersetuser。SQLAlchemy我试图在 Apache Superset 中传递的URI 如下所示:
mysql://supersetuser:superset@localhost:8889/apache_superset
Run Code Online (Sandbox Code Playgroud)
我很确定凭据是正确的,因为我刚刚创建了它们。此外,我还尝试为用户分配所需的权限
GRANT ALL PRIVILEGES ON `apache_superset`.* TO 'supersetuser'@'localhost' WITH GRANT OPTION;
Run Code Online (Sandbox Code Playgroud)
但我仍然无法将数据库连接到 Apache Superset。
我在使用 python 中的对象编写嵌套 for 循环时遇到问题csv。我想解析这两个csv文件并比较其中的一部分。因此我编写了下面的嵌套循环。我期望的是,python 解析内循环以获得外循环的第一项,然后对于外循环的第二项,他再次解析内循环,依此类推。发生的情况是,内部循环被解析,然后外部循环被传递,甚至没有再次进入内部循环。
当使用csv像这样的非对象时num_list = [1, 2, 3],它会像预期的那样工作。
谢谢。
import csv
csvfile = open('/Users/rene/Downloads/Test/Export.csv', newline='', encoding='windows-1252')
spamreader = csv.reader(csvfile, dialect='excel', delimiter=';')
csvfile1 = open('/Users/rene/Downloads/Test/Transfer.csv', newline='', encoding='windows-1252')
spamreader1 = csv.reader(csvfile1, dialect='excel', delimiter=';')
for row in spamreader:
print("1row:"+row[1])
for row1 in spamreader1:
print("2row:"+row[1])
print("2row1:"+row1[0])
csvfile.close()
csvfile1.close()
Run Code Online (Sandbox Code Playgroud) 我SQLAlchemy第一次使用将大约 600 万条记录导出到 MySQL。以下是我收到的错误:
OperationalError: (mysql.connector.errors.OperationalError) 2055: Lost connection to MySQL server at '127.0.0.1:3306', system error: 10053 An established connection was aborted by the software in your host machine
Run Code Online (Sandbox Code Playgroud)
代码:
import pandas as pd
import sqlalchemy
df=pd.read_excel(r"C:\Users\mazin\1-601.xlsx")
database_username = 'root'
database_password = 'aUtO1115'
database_ip = '127.0.0.1'
database_name = 'patenting in psis'
database_connection = sqlalchemy.create_engine('mysql+mysqlconnector://{0}:{1}@{2}/{3}'.
format(database_username, database_password,
database_ip, database_name), pool_recycle=1, pool_timeout=30).connect()
df.to_sql(con=database_connection, name='sample', if_exists='replace')
database_connection.close()
Run Code Online (Sandbox Code Playgroud)
注意:如果我导出大约 100 条记录,我不会收到错误消息。参考类似帖子后,我添加了pool_recycle和pool_timeout参数,但错误仍然存在。
在运行 kafka 消费者时,我收到以下错误:
Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 13
Caused by: org.apache.avro.AvroTypeException: Invalid default for field key_id: "null" not a ["null",{"type":"string","avro.java.string":"String"}]
at org.apache.avro.Schema.validateDefault(Schema.java:1512)
at org.apache.avro.Schema.access$300(Schema.java:86)
at org.apache.avro.Schema$Field.<init>(Schema.java:493
Run Code Online (Sandbox Code Playgroud)
我的 avro 架构是这样的:
{ "name": "key_id", "type": [ "null", "string" ], "default": "null"},
Run Code Online (Sandbox Code Playgroud)
我尝试了多种选择来解决这个问题,但它仍然存在。
serialization avro deserialization apache-kafka confluent-schema-registry
我需要更好地理解我的 LightGBM 模型,所以我使用 SHAP Tree 解释器。需要lightgbm对数据进行编码,我将相同的数据传递给树解释器。因此,我担心 SHAPTreeExplainer会将shap_values()我的数据视为数字数据。如何指定数据是分类的?这会改变 SHAP 值的计算吗?
我已经浏览过文档了。
python ×5
apache-kafka ×3
mysql ×3
sqlalchemy ×2
avro ×1
bayesian ×1
csv ×1
lightgbm ×1
loops ×1
mamp ×1
mysql-python ×1
naivebayes ×1
python-3.x ×1
scikit-learn ×1
shap ×1
svm ×1