update bug
This commit is contained in:
parent
ccefd36160
commit
cc7701236a
@ -389,7 +389,8 @@ async def _extract_calculation_params_b1(data: UserValuationCreate) -> Dict[str,
|
||||
# followers 非当前计算用键,先移除避免干扰
|
||||
|
||||
# click_count 与 view_count 目前未参与计算,先移除
|
||||
|
||||
'sales_volume': safe_float(data.sales_volume),#
|
||||
'link_views': safe_float(data.link_views),
|
||||
# 政策乘数B13相关参数
|
||||
'implementation_stage': implementation_stage,
|
||||
'funding_support': funding_support
|
||||
@ -434,8 +435,8 @@ async def _extract_calculation_params_b2(data: UserValuationCreate) -> Dict[str,
|
||||
# 以下三项需由后续模型/服务计算;此处提供默认可计算占位
|
||||
# 历史传承度HI(用户填写)
|
||||
historical_inheritance = sum([safe_float(i) for i in data.historical_evidence])
|
||||
structure_complexity = 0.75 # TODO 需要依赖图片和模型 结构复杂度SC(系统计算)
|
||||
normalized_entropy = 0.85 # TODO 需要依赖图片和模型 归一化信息熵H(系统计算)
|
||||
structure_complexity = 1.5 # 默认值 纹样基因熵值B22(系统计算)
|
||||
normalized_entropy = 9 # 默认值 归一化信息熵H(系统计算)
|
||||
|
||||
return {
|
||||
"inheritor_level_coefficient": inheritor_level_coefficient,
|
||||
|
||||
@ -127,10 +127,10 @@ if __name__ == "__main__":
|
||||
inheritor_level = "国家级传承人" # 传承人等级 (用户填写)
|
||||
cross_border_depth = 50.0
|
||||
# 教学传播频次数据
|
||||
offline_sessions = 10 # 线下传习次数(符合标准:传承人主导、时长≥2小时、参与人数≥5人)
|
||||
douyin_views = 1000000 # 抖音播放量
|
||||
kuaishou_views = 500000 # 快手播放量
|
||||
bilibili_views = 200000 # B站播放量
|
||||
offline_sessions = 20 # 线下传习次数(符合标准:传承人主导、时长≥2小时、参与人数≥5人)
|
||||
douyin_views = 10000000 # 抖音播放量
|
||||
kuaishou_views = 0 # 快手播放量
|
||||
bilibili_views = 0 # B站播放量
|
||||
|
||||
|
||||
|
||||
@ -142,10 +142,11 @@ if __name__ == "__main__":
|
||||
kuaishou_views=kuaishou_views,
|
||||
bilibili_views=bilibili_views
|
||||
)
|
||||
print(teaching_frequency)
|
||||
|
||||
# 计算活态传承系数B21
|
||||
living_heritage_b21 = calculator.calculate_living_heritage_b21(
|
||||
inheritor_level_coefficient, teaching_frequency, cross_border_depth
|
||||
1, teaching_frequency, 0.3
|
||||
)
|
||||
|
||||
print(f"传承人等级系数: {inheritor_level_coefficient:.2f}")
|
||||
|
||||
@ -134,7 +134,7 @@ if __name__ == "__main__":
|
||||
|
||||
# 计算纹样基因值B22
|
||||
pattern_gene_b22 = calculator.calculate_pattern_gene_b22(
|
||||
structure_complexity, normalized_entropy, historical_inheritance
|
||||
1.5, 9, historical_inheritance
|
||||
)
|
||||
|
||||
print(f"结构复杂度SC: {structure_complexity:.4f}")
|
||||
|
||||
@ -88,18 +88,28 @@ class EconomicValueB1Calculator:
|
||||
# )
|
||||
# 计算基础价值B11
|
||||
basic_value_b11 = self.basic_value_calculator.calculate_basic_value_b11(
|
||||
financial_value,
|
||||
legal_strength,
|
||||
financial_value, # 财务价值F
|
||||
legal_strength, # 法律强度L
|
||||
development_potential,
|
||||
input_data["industry_coefficient"]
|
||||
)
|
||||
|
||||
# 计算流量因子B12
|
||||
social_media_spread_s3 = self.traffic_factor_calculator.calculate_interaction_index(
|
||||
# 计算互动量指数
|
||||
interaction_index = self.traffic_factor_calculator.calculate_interaction_index(
|
||||
input_data["likes"],
|
||||
input_data["comments"],
|
||||
input_data["shares"],
|
||||
)
|
||||
# 计算覆盖人群指数
|
||||
coverage_index = self.traffic_factor_calculator.calculate_coverage_index(0)
|
||||
# 计算转化率
|
||||
conversion_efficiency = self.traffic_factor_calculator.calculate_conversion_efficiency(
|
||||
input_data["sales_volume"], input_data["link_views"])
|
||||
|
||||
social_media_spread_s3 = self.traffic_factor_calculator.calculate_social_media_spread_s3(interaction_index,
|
||||
coverage_index,
|
||||
conversion_efficiency)
|
||||
|
||||
traffic_factor_b12 = self.traffic_factor_calculator.calculate_traffic_factor_b12(
|
||||
input_data['search_index_s1'],
|
||||
input_data['industry_average_s2'],
|
||||
@ -164,28 +174,29 @@ if __name__ == "__main__":
|
||||
'''
|
||||
input_data = {
|
||||
# 基础价值B11相关参数
|
||||
'three_year_income': [1000, 2000, 2222],
|
||||
'patent_score': 1, # 专利分
|
||||
'popularity_score': 4.0, # 普及地域分值
|
||||
'infringement_score': 1.0, # 侵权分
|
||||
'innovation_ratio': 600.0,
|
||||
'esg_score':10.0,
|
||||
'industry_coefficient':12.0,
|
||||
'three_year_income': [2000, 2400, 2600],
|
||||
'patent_score': 0, # 专利分
|
||||
'patent_count': 0, # 专利分
|
||||
'popularity_score': 10.0, # 普及地域分值
|
||||
'infringement_score': 0, # 侵权分
|
||||
'innovation_ratio': 1200 / 3000,
|
||||
'esg_score': 7.0,
|
||||
'industry_coefficient': -0.0625, # 行业系数
|
||||
|
||||
# 流量因子B12相关参数
|
||||
'search_index_s1': 4500.0,
|
||||
'industry_average_s2': 5000.0,
|
||||
'search_index_s1': 0,
|
||||
'industry_average_s2': 15000, # 行业均值
|
||||
# 'social_media_spread_s3': social_media_spread_s3,
|
||||
'likes': 4, # 点赞
|
||||
'comments': 5, # 评论
|
||||
'shares': 6, # 转发
|
||||
'followers': 7, # 粉丝数
|
||||
'likes': 3933333.33, # 点赞
|
||||
'comments': 3933333.33, # 评论
|
||||
'shares': 3933333.33, # 转发
|
||||
'followers': 15000, # 粉丝数
|
||||
|
||||
'click_count': 1000,# 点击量
|
||||
'view_count': 100, # 内容浏览量
|
||||
"sales_volume": 5000,
|
||||
"link_views": 20000,
|
||||
|
||||
# 政策乘数B13相关参数
|
||||
'policy_match_score': 10.0, # 政策匹配度
|
||||
'policy_match_score': 7.0, # 政策匹配度
|
||||
'implementation_stage': 10.0, # 实施阶段评分
|
||||
'funding_support': 10.0 # 资金支持度
|
||||
}
|
||||
|
||||
@ -67,6 +67,8 @@ class BasicValueB11Calculator:
|
||||
# 如果没有提供增长率,则根据三年数据计算
|
||||
if growth_rate is None:
|
||||
growth_rate = self._calculate_growth_rate(annual_revenue_3_years)
|
||||
growth_factor = (1 + growth_rate) ** 5
|
||||
result = avg_annual_revenue * growth_factor / 5
|
||||
|
||||
financial_value = (avg_annual_revenue * math.pow(1 + growth_rate, 5)) / 5
|
||||
|
||||
@ -261,7 +263,7 @@ if __name__ == "__main__":
|
||||
calculator = BasicValueB11Calculator()
|
||||
|
||||
# 示例数据
|
||||
annual_revenue = [100, 120, 150] # 近三年收益,单位:万元 (用户填写)
|
||||
annual_revenue = [2000,2400,2600] # 近三年收益,单位:万元 (用户填写)
|
||||
patent_remaining_years = 8 # 专利剩余年限 (用户填写)
|
||||
region_coverage = "全国覆盖" # 普及地域 (用户填写)
|
||||
infringement_status = "无侵权记录" # 侵权记录 (用户填写)
|
||||
@ -276,17 +278,19 @@ if __name__ == "__main__":
|
||||
patent_score = calculate_patent_score(patent_remaining_years)
|
||||
popularity_score = calculate_popularity_score(region_coverage)
|
||||
infringement_score = calculate_infringement_score(infringement_status)
|
||||
legal_strength = calculator.calculate_legal_strength_l(patent_score, popularity_score, infringement_score)
|
||||
# legal_strength = calculator.calculate_legal_strength_l(patent_score, popularity_score, infringement_score)
|
||||
legal_strength = calculator.calculate_legal_strength_l(0, 10, 0)
|
||||
|
||||
patent_usage_score = calculate_patent_usage_score(patent_count)
|
||||
development_potential = calculator.calculate_development_potential_d(patent_usage_score, esg_score,
|
||||
innovation_ratio)
|
||||
|
||||
# development_potential = calculator.calculate_development_potential_d(patent_usage_score, esg_score,
|
||||
# innovation_ratio)
|
||||
development_potential = calculator.calculate_development_potential_d(0, 7,
|
||||
1200/3000)
|
||||
industry_coefficient = calculator.calculate_industry_coefficient_i(target_industry_roe, benchmark_industry_roe)
|
||||
|
||||
# 计算基础价值B11
|
||||
basic_value = calculator.calculate_basic_value_b11(
|
||||
financial_value, legal_strength, development_potential, industry_coefficient
|
||||
770.0, legal_strength, development_potential, -0.0625
|
||||
)
|
||||
|
||||
print(f"财务价值F: {financial_value:.2f}")
|
||||
@ -294,3 +298,21 @@ if __name__ == "__main__":
|
||||
print(f"发展潜力D: {development_potential:.2f}")
|
||||
print(f"行业系数I: {industry_coefficient:.4f}")
|
||||
print(f"基础价值B11: {basic_value:.2f}")
|
||||
# initial_value = 2333
|
||||
# growth_rate = 0.14 # 14%
|
||||
# years = 5
|
||||
#
|
||||
# # 计算 (1+14%)^5
|
||||
# growth_factor = (1 + growth_rate) ** years
|
||||
#
|
||||
# # 计算 2333 * (1+14%)^5 / 5
|
||||
# result = initial_value * growth_factor / 5
|
||||
|
||||
# print(f"2333 * (1+14%)^5 / 5 = {result:.2f}")
|
||||
#
|
||||
# 也可以分步显示计算过程
|
||||
# print("\n计算过程:")
|
||||
# print(f"增长率: {growth_rate*100}%")
|
||||
# print(f"(1+14%)^5 = {growth_factor:.4f}")
|
||||
# print(f"2333 × {growth_factor:.4f} = {initial_value * growth_factor:.2f}")
|
||||
# print(f"再除以5: {initial_value * growth_factor:.2f} ÷ 5 = {result:.2f}")
|
||||
@ -121,7 +121,7 @@ if __name__ == "__main__":
|
||||
|
||||
# 计算政策契合度评分P
|
||||
policy_compatibility_score = calculator.calculate_policy_compatibility_score(
|
||||
policy_match_score, implementation_stage_score, funding_support_score
|
||||
7, 10, 10
|
||||
)
|
||||
|
||||
# 计算政策乘数B13
|
||||
|
||||
@ -101,9 +101,10 @@ class TrafficFactorB12Calculator:
|
||||
returns:
|
||||
float: 覆盖人群指数
|
||||
"""
|
||||
#
|
||||
#
|
||||
if followers == 0:
|
||||
return 0
|
||||
coverage_index = followers / 10000.0
|
||||
|
||||
return coverage_index
|
||||
|
||||
def calculate_conversion_efficiency(self,
|
||||
@ -116,7 +117,7 @@ class TrafficFactorB12Calculator:
|
||||
转化效率 = 商品链接点击量 / 内容浏览量
|
||||
|
||||
args:
|
||||
click_count: 商品链接点击量 (用户填写)
|
||||
click_count: 商品链接点击量/销售 (用户填写)
|
||||
view_count: 内容浏览量 (用户填写)
|
||||
|
||||
returns:
|
||||
@ -287,13 +288,16 @@ if __name__ == "__main__":
|
||||
search_index_s1 = calculate_search_index_s1(baidu_index, wechat_index, weibo_index)
|
||||
interaction_index, coverage_index = processor.calculate_multi_platform_interaction(platform_data)
|
||||
conversion_efficiency = calculator.calculate_conversion_efficiency(click_count, view_count)
|
||||
# 互动量指数 × 0.4 + 覆盖人群指数 × 0.3 + 转化效率 × 0.3
|
||||
# social_media_spread_s3 = calculator.calculate_social_media_spread_s3(
|
||||
# interaction_index, coverage_index, conversion_efficiency
|
||||
# )
|
||||
social_media_spread_s3 = calculator.calculate_social_media_spread_s3(
|
||||
interaction_index, coverage_index, conversion_efficiency
|
||||
11800, 1.5, 0.25
|
||||
)
|
||||
|
||||
# 计算流量因子B12
|
||||
traffic_factor = calculator.calculate_traffic_factor_b12(
|
||||
search_index_s1, industry_average, social_media_spread_s3
|
||||
search_index_s1, 15000, social_media_spread_s3
|
||||
)
|
||||
|
||||
print(f"近30天搜索指数S1: {search_index_s1:.2f}")
|
||||
|
||||
@ -212,7 +212,7 @@ if __name__ == "__main__":
|
||||
'model_data': {
|
||||
'economic_data': {
|
||||
# 基础价值B11相关参数
|
||||
'three_year_income': [1000, 2000, 2222],
|
||||
'three_year_income': [2000,2400,2600],
|
||||
'patent_score': 1, # 专利分 (0-10)
|
||||
'popularity_score': 4.0, # 普及地域分 (0-10)
|
||||
'infringement_score': 1.0, # 侵权分 (0-10)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
"""
|
||||
模型估值B计算模块
|
||||
|
||||
@ -21,7 +20,7 @@ except ImportError:
|
||||
|
||||
class ModelValueBCalculator:
|
||||
"""模型估值B计算器"""
|
||||
|
||||
|
||||
def __init__(self):
|
||||
"""初始化计算器"""
|
||||
self.economic_value_calculator = EconomicValueB1Calculator()
|
||||
@ -29,9 +28,9 @@ class ModelValueBCalculator:
|
||||
self.risk_adjustment_calculator = RiskAdjustmentB3Calculator()
|
||||
|
||||
def calculate_model_value_b(self,
|
||||
economic_value_b1: float,
|
||||
cultural_value_b2: float,
|
||||
risk_value_b3: float) -> float:
|
||||
economic_value_b1: float,
|
||||
cultural_value_b2: float,
|
||||
risk_value_b3: float) -> float:
|
||||
"""
|
||||
模型估值B = (经济价值B1*0.7+文化价值B2*0.3)*风险调整系数B3
|
||||
|
||||
@ -44,9 +43,9 @@ class ModelValueBCalculator:
|
||||
float: 模型估值B
|
||||
"""
|
||||
model_value = (economic_value_b1 * 0.7 + cultural_value_b2 * 0.3) * risk_value_b3
|
||||
|
||||
|
||||
return model_value
|
||||
|
||||
|
||||
def calculate_complete_model_value_b(self, input_data: Dict) -> Dict:
|
||||
"""
|
||||
计算完整的模型估值B,包含所有子公式
|
||||
@ -62,7 +61,7 @@ class ModelValueBCalculator:
|
||||
input_data['economic_data']
|
||||
)
|
||||
economic_value_b1 = economic_result['economic_value_b1']
|
||||
|
||||
|
||||
# 计算文化价值B2
|
||||
cultural_result = self.cultural_value_calculator.calculate_complete_cultural_value_b2(
|
||||
input_data['cultural_data']
|
||||
@ -79,7 +78,7 @@ class ModelValueBCalculator:
|
||||
cultural_value_b2,
|
||||
risk_value_b3
|
||||
)
|
||||
|
||||
|
||||
return {
|
||||
'economic_value_b1': economic_value_b1,
|
||||
'cultural_value_b2': cultural_value_b2,
|
||||
@ -92,7 +91,7 @@ class ModelValueBCalculator:
|
||||
if __name__ == "__main__":
|
||||
# 创建计算器实例
|
||||
calculator = ModelValueBCalculator()
|
||||
|
||||
|
||||
# 示例数据
|
||||
input_data = {
|
||||
# 经济价值B1相关数据
|
||||
@ -104,9 +103,11 @@ if __name__ == "__main__":
|
||||
'search_index_s1': 4500.0,
|
||||
'industry_average_s2': 5000.0,
|
||||
'social_media_spread_s3': 1.07,
|
||||
'policy_compatibility_score': 9.1
|
||||
'policy_compatibility_score': 9.1,
|
||||
'sales_volume': 99, # 销售量
|
||||
'link_views': 88 # 浏览量
|
||||
},
|
||||
|
||||
|
||||
# 文化价值B2相关数据
|
||||
'cultural_data': {
|
||||
'inheritor_level_coefficient': 10.0,
|
||||
@ -117,10 +118,10 @@ if __name__ == "__main__":
|
||||
'historical_inheritance': 0.80
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# 计算模型估值B
|
||||
result = calculator.calculate_complete_model_value_b(input_data)
|
||||
|
||||
|
||||
print("模型估值B计算结果:")
|
||||
print(f"经济价值B1: {result['economic_value_b1']:.2f}")
|
||||
print(f"文化价值B2: {result['cultural_value_b2']:.4f}")
|
||||
|
||||
@ -48,7 +48,7 @@ class RiskAdjustmentB3Calculator:
|
||||
float: 风险评分总和R
|
||||
"""
|
||||
|
||||
risk_score_sum = market_risk * 0.3 + legal_risk * 0.4 + inheritance_risk * 0.3
|
||||
risk_score_sum = (market_risk * 0.3 + legal_risk * 0.4 + inheritance_risk * 0.3)/10
|
||||
|
||||
return risk_score_sum
|
||||
|
||||
@ -179,14 +179,14 @@ if __name__ == "__main__":
|
||||
|
||||
# 示例数据
|
||||
# 市场风险:过去30天价格数据
|
||||
highest_price = 100.0 # 过去30天最高价格 (用户填写)
|
||||
lowest_price = 95.0 # 过去30天最低价格 (用户填写)
|
||||
highest_price = 340 # 过去30天最高价格 (用户填写)
|
||||
lowest_price = 300 # 过去30天最低价格 (用户填写)
|
||||
|
||||
# 法律风险:诉讼状态
|
||||
lawsuit_status = "无诉讼" # 诉讼状态 (API获取)
|
||||
lawsuit_status = 10 # 诉讼状态 (API获取)
|
||||
|
||||
# 传承风险:传承人年龄
|
||||
inheritor_ages = [45, 60, 75] # 传承人年龄列表 (用户填写)
|
||||
inheritor_ages = [100,20,5] # 传承人年龄列表 (用户填写)
|
||||
|
||||
# 计算各项风险评分
|
||||
market_risk = calculator.calculate_market_risk(highest_price, lowest_price)
|
||||
|
||||
9149
web/package-lock.json
generated
Normal file
9149
web/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user